pub struct Client { /* private fields */ }
Expand description
Client for AWS CloudHSM V2
Client for invoking operations on AWS CloudHSM V2. Each operation on AWS CloudHSM V2 is a method on this
this struct. .send()
MUST be invoked on the generated operations to dispatch the request to the service.
§Constructing a Client
A Config
is required to construct a client. For most use cases, the aws-config
crate should be used to automatically resolve this config using
aws_config::load_from_env()
, since this will resolve an SdkConfig
which can be shared
across multiple different AWS SDK clients. This config resolution process can be customized
by calling aws_config::from_env()
instead, which returns a ConfigLoader
that uses
the builder pattern to customize the default config.
In the simplest case, creating a client looks as follows:
let config = aws_config::load_from_env().await;
let client = aws_sdk_cloudhsmv2::Client::new(&config);
Occasionally, SDKs may have additional service-specific values that can be set on the Config
that
is absent from SdkConfig
, or slightly different settings for a specific client may be desired.
The Builder
struct implements From<&SdkConfig>
, so setting these specific settings can be
done as follows:
let sdk_config = ::aws_config::load_from_env().await;
let config = aws_sdk_cloudhsmv2::config::Builder::from(&sdk_config)
.some_service_specific_setting("value")
.build();
See the aws-config
docs and Config
for more information on customizing configuration.
Note: Client construction is expensive due to connection thread pool initialization, and should be done once at application start-up.
§Using the Client
A client has a function for every operation that can be performed by the service.
For example, the CopyBackupToRegion
operation has
a Client::copy_backup_to_region
, function which returns a builder for that operation.
The fluent builder ultimately has a send()
function that returns an async future that
returns a result, as illustrated below:
let result = client.copy_backup_to_region()
.destination_region("example")
.send()
.await;
The underlying HTTP requests that get made by this can be modified with the customize_operation
function on the fluent builder. See the customize
module for more
information.
Implementations§
Source§impl Client
impl Client
Sourcepub fn copy_backup_to_region(&self) -> CopyBackupToRegionFluentBuilder
pub fn copy_backup_to_region(&self) -> CopyBackupToRegionFluentBuilder
Constructs a fluent builder for the CopyBackupToRegion
operation.
- The fluent builder is configurable:
destination_region(impl Into<String>)
/set_destination_region(Option<String>)
:
required: trueThe AWS region that will contain your copied CloudHSM cluster backup.
backup_id(impl Into<String>)
/set_backup_id(Option<String>)
:
required: trueThe ID of the backup that will be copied to the destination region.
tag_list(Tag)
/set_tag_list(Option<Vec::<Tag>>)
:
required: falseTags to apply to the destination backup during creation. If you specify tags, only these tags will be applied to the destination backup. If you do not specify tags, the service copies tags from the source backup to the destination backup.
- On success, responds with
CopyBackupToRegionOutput
with field(s):destination_backup(Option<DestinationBackup>)
:Information on the backup that will be copied to the destination region, including CreateTimestamp, SourceBackup, SourceCluster, and Source Region. CreateTimestamp of the destination backup will be the same as that of the source backup.
You will need to use the
sourceBackupID
returned in this operation to use theDescribeBackups
operation on the backup that will be copied to the destination region.
- On failure, responds with
SdkError<CopyBackupToRegionError>
Source§impl Client
impl Client
Sourcepub fn create_cluster(&self) -> CreateClusterFluentBuilder
pub fn create_cluster(&self) -> CreateClusterFluentBuilder
Constructs a fluent builder for the CreateCluster
operation.
- The fluent builder is configurable:
backup_retention_policy(BackupRetentionPolicy)
/set_backup_retention_policy(Option<BackupRetentionPolicy>)
:
required: falseA policy that defines how the service retains backups.
hsm_type(impl Into<String>)
/set_hsm_type(Option<String>)
:
required: trueThe type of HSM to use in the cluster. The allowed values are
hsm1.medium
andhsm2m.medium
.source_backup_id(impl Into<String>)
/set_source_backup_id(Option<String>)
:
required: falseThe identifier (ID) or the Amazon Resource Name (ARN) of the cluster backup to restore. Use this value to restore the cluster from a backup instead of creating a new cluster. To find the backup ID or ARN, use
DescribeBackups
. If using a backup in another account, the full ARN must be supplied.subnet_ids(impl Into<String>)
/set_subnet_ids(Option<Vec::<String>>)
:
required: trueThe identifiers (IDs) of the subnets where you are creating the cluster. You must specify at least one subnet. If you specify multiple subnets, they must meet the following criteria:
-
All subnets must be in the same virtual private cloud (VPC).
-
You can specify only one subnet per Availability Zone.
-
network_type(NetworkType)
/set_network_type(Option<NetworkType>)
:
required: falseThe NetworkType to create a cluster with. The allowed values are
IPV4
andDUALSTACK
.tag_list(Tag)
/set_tag_list(Option<Vec::<Tag>>)
:
required: falseTags to apply to the CloudHSM cluster during creation.
mode(ClusterMode)
/set_mode(Option<ClusterMode>)
:
required: falseThe mode to use in the cluster. The allowed values are
FIPS
andNON_FIPS
.
- On success, responds with
CreateClusterOutput
with field(s):cluster(Option<Cluster>)
:Information about the cluster that was created.
- On failure, responds with
SdkError<CreateClusterError>
Source§impl Client
impl Client
Sourcepub fn create_hsm(&self) -> CreateHsmFluentBuilder
pub fn create_hsm(&self) -> CreateHsmFluentBuilder
Constructs a fluent builder for the CreateHsm
operation.
- The fluent builder is configurable:
cluster_id(impl Into<String>)
/set_cluster_id(Option<String>)
:
required: trueThe identifier (ID) of the HSM’s cluster. To find the cluster ID, use
DescribeClusters
.availability_zone(impl Into<String>)
/set_availability_zone(Option<String>)
:
required: trueThe Availability Zone where you are creating the HSM. To find the cluster’s Availability Zones, use
DescribeClusters
.ip_address(impl Into<String>)
/set_ip_address(Option<String>)
:
required: falseThe HSM’s IP address. If you specify an IP address, use an available address from the subnet that maps to the Availability Zone where you are creating the HSM. If you don’t specify an IP address, one is chosen for you from that subnet.
- On success, responds with
CreateHsmOutput
with field(s):hsm(Option<Hsm>)
:Information about the HSM that was created.
- On failure, responds with
SdkError<CreateHsmError>
Source§impl Client
impl Client
Sourcepub fn delete_backup(&self) -> DeleteBackupFluentBuilder
pub fn delete_backup(&self) -> DeleteBackupFluentBuilder
Constructs a fluent builder for the DeleteBackup
operation.
- The fluent builder is configurable:
backup_id(impl Into<String>)
/set_backup_id(Option<String>)
:
required: trueThe ID of the backup to be deleted. To find the ID of a backup, use the
DescribeBackups
operation.
- On success, responds with
DeleteBackupOutput
with field(s):backup(Option<Backup>)
:Information on the
Backup
object deleted.
- On failure, responds with
SdkError<DeleteBackupError>
Source§impl Client
impl Client
Sourcepub fn delete_cluster(&self) -> DeleteClusterFluentBuilder
pub fn delete_cluster(&self) -> DeleteClusterFluentBuilder
Constructs a fluent builder for the DeleteCluster
operation.
- The fluent builder is configurable:
cluster_id(impl Into<String>)
/set_cluster_id(Option<String>)
:
required: trueThe identifier (ID) of the cluster that you are deleting. To find the cluster ID, use
DescribeClusters
.
- On success, responds with
DeleteClusterOutput
with field(s):cluster(Option<Cluster>)
:Information about the cluster that was deleted.
- On failure, responds with
SdkError<DeleteClusterError>
Source§impl Client
impl Client
Sourcepub fn delete_hsm(&self) -> DeleteHsmFluentBuilder
pub fn delete_hsm(&self) -> DeleteHsmFluentBuilder
Constructs a fluent builder for the DeleteHsm
operation.
- The fluent builder is configurable:
cluster_id(impl Into<String>)
/set_cluster_id(Option<String>)
:
required: trueThe identifier (ID) of the cluster that contains the HSM that you are deleting.
hsm_id(impl Into<String>)
/set_hsm_id(Option<String>)
:
required: falseThe identifier (ID) of the HSM that you are deleting.
eni_id(impl Into<String>)
/set_eni_id(Option<String>)
:
required: falseThe identifier (ID) of the elastic network interface (ENI) of the HSM that you are deleting.
eni_ip(impl Into<String>)
/set_eni_ip(Option<String>)
:
required: falseThe IP address of the elastic network interface (ENI) of the HSM that you are deleting.
- On success, responds with
DeleteHsmOutput
with field(s):hsm_id(Option<String>)
:The identifier (ID) of the HSM that was deleted.
- On failure, responds with
SdkError<DeleteHsmError>
Source§impl Client
impl Client
Sourcepub fn delete_resource_policy(&self) -> DeleteResourcePolicyFluentBuilder
pub fn delete_resource_policy(&self) -> DeleteResourcePolicyFluentBuilder
Constructs a fluent builder for the DeleteResourcePolicy
operation.
- The fluent builder is configurable:
resource_arn(impl Into<String>)
/set_resource_arn(Option<String>)
:
required: falseAmazon Resource Name (ARN) of the resource from which the policy will be removed.
- On success, responds with
DeleteResourcePolicyOutput
with field(s):resource_arn(Option<String>)
:Amazon Resource Name (ARN) of the resource from which the policy was deleted.
policy(Option<String>)
:The policy previously attached to the resource.
- On failure, responds with
SdkError<DeleteResourcePolicyError>
Source§impl Client
impl Client
Sourcepub fn describe_backups(&self) -> DescribeBackupsFluentBuilder
pub fn describe_backups(&self) -> DescribeBackupsFluentBuilder
Constructs a fluent builder for the DescribeBackups
operation.
This operation supports pagination; See into_paginator()
.
- The fluent builder is configurable:
next_token(impl Into<String>)
/set_next_token(Option<String>)
:
required: falseThe
NextToken
value that you received in the previous response. Use this value to get more backups.max_results(i32)
/set_max_results(Option<i32>)
:
required: falseThe maximum number of backups to return in the response. When there are more backups than the number you specify, the response contains a
NextToken
value.filters(impl Into<String>, Vec::<String>)
/set_filters(Option<HashMap::<String, Vec::<String>>>)
:
required: falseOne or more filters to limit the items returned in the response.
Use the
backupIds
filter to return only the specified backups. Specify backups by their backup identifier (ID).Use the
sourceBackupIds
filter to return only the backups created from a source backup. ThesourceBackupID
of a source backup is returned by theCopyBackupToRegion
operation.Use the
clusterIds
filter to return only the backups for the specified clusters. Specify clusters by their cluster identifier (ID).Use the
states
filter to return only backups that match the specified state.Use the
neverExpires
filter to return backups filtered by the value in theneverExpires
parameter.True
returns all backups exempt from the backup retention policy.False
returns all backups with a backup retention policy defined at the cluster.shared(bool)
/set_shared(Option<bool>)
:
required: falseDescribe backups that are shared with you.
By default when using this option, the command returns backups that have been shared using a standard Resource Access Manager resource share. In order for a backup that was shared using the PutResourcePolicy command to be returned, the share must be promoted to a standard resource share using the RAM PromoteResourceShareCreatedFromPolicy API operation. For more information about sharing backups, see Working with shared backups in the CloudHSM User Guide.
sort_ascending(bool)
/set_sort_ascending(Option<bool>)
:
required: falseDesignates whether or not to sort the return backups by ascending chronological order of generation.
- On success, responds with
DescribeBackupsOutput
with field(s):backups(Option<Vec::<Backup>>)
:A list of backups.
next_token(Option<String>)
:An opaque string that indicates that the response contains only a subset of backups. Use this value in a subsequent
DescribeBackups
request to get more backups.
- On failure, responds with
SdkError<DescribeBackupsError>
Source§impl Client
impl Client
Sourcepub fn describe_clusters(&self) -> DescribeClustersFluentBuilder
pub fn describe_clusters(&self) -> DescribeClustersFluentBuilder
Constructs a fluent builder for the DescribeClusters
operation.
This operation supports pagination; See into_paginator()
.
- The fluent builder is configurable:
filters(impl Into<String>, Vec::<String>)
/set_filters(Option<HashMap::<String, Vec::<String>>>)
:
required: falseOne or more filters to limit the items returned in the response.
Use the
clusterIds
filter to return only the specified clusters. Specify clusters by their cluster identifier (ID).Use the
vpcIds
filter to return only the clusters in the specified virtual private clouds (VPCs). Specify VPCs by their VPC identifier (ID).Use the
states
filter to return only clusters that match the specified state.next_token(impl Into<String>)
/set_next_token(Option<String>)
:
required: falseThe
NextToken
value that you received in the previous response. Use this value to get more clusters.max_results(i32)
/set_max_results(Option<i32>)
:
required: falseThe maximum number of clusters to return in the response. When there are more clusters than the number you specify, the response contains a
NextToken
value.
- On success, responds with
DescribeClustersOutput
with field(s):clusters(Option<Vec::<Cluster>>)
:A list of clusters.
next_token(Option<String>)
:An opaque string that indicates that the response contains only a subset of clusters. Use this value in a subsequent
DescribeClusters
request to get more clusters.
- On failure, responds with
SdkError<DescribeClustersError>
Source§impl Client
impl Client
Sourcepub fn get_resource_policy(&self) -> GetResourcePolicyFluentBuilder
pub fn get_resource_policy(&self) -> GetResourcePolicyFluentBuilder
Constructs a fluent builder for the GetResourcePolicy
operation.
- The fluent builder is configurable:
resource_arn(impl Into<String>)
/set_resource_arn(Option<String>)
:
required: falseAmazon Resource Name (ARN) of the resource to which a policy is attached.
- On success, responds with
GetResourcePolicyOutput
with field(s):policy(Option<String>)
:The policy attached to a resource.
- On failure, responds with
SdkError<GetResourcePolicyError>
Source§impl Client
impl Client
Sourcepub fn initialize_cluster(&self) -> InitializeClusterFluentBuilder
pub fn initialize_cluster(&self) -> InitializeClusterFluentBuilder
Constructs a fluent builder for the InitializeCluster
operation.
- The fluent builder is configurable:
cluster_id(impl Into<String>)
/set_cluster_id(Option<String>)
:
required: trueThe identifier (ID) of the cluster that you are claiming. To find the cluster ID, use
DescribeClusters
.signed_cert(impl Into<String>)
/set_signed_cert(Option<String>)
:
required: trueThe cluster certificate issued (signed) by your issuing certificate authority (CA). The certificate must be in PEM format and can contain a maximum of 5000 characters.
trust_anchor(impl Into<String>)
/set_trust_anchor(Option<String>)
:
required: trueThe issuing certificate of the issuing certificate authority (CA) that issued (signed) the cluster certificate. You must use a self-signed certificate. The certificate used to sign the HSM CSR must be directly available, and thus must be the root certificate. The certificate must be in PEM format and can contain a maximum of 5000 characters.
- On success, responds with
InitializeClusterOutput
with field(s):state(Option<ClusterState>)
:The cluster’s state.
state_message(Option<String>)
:A description of the cluster’s state.
- On failure, responds with
SdkError<InitializeClusterError>
Source§impl Client
impl Client
Constructs a fluent builder for the ListTags
operation.
This operation supports pagination; See into_paginator()
.
- The fluent builder is configurable:
resource_id(impl Into<String>)
/set_resource_id(Option<String>)
:
required: trueThe cluster identifier (ID) for the cluster whose tags you are getting. To find the cluster ID, use
DescribeClusters
.next_token(impl Into<String>)
/set_next_token(Option<String>)
:
required: falseThe
NextToken
value that you received in the previous response. Use this value to get more tags.max_results(i32)
/set_max_results(Option<i32>)
:
required: falseThe maximum number of tags to return in the response. When there are more tags than the number you specify, the response contains a
NextToken
value.
- On success, responds with
ListTagsOutput
with field(s):tag_list(Vec::<Tag>)
:A list of tags.
next_token(Option<String>)
:An opaque string that indicates that the response contains only a subset of tags. Use this value in a subsequent
ListTags
request to get more tags.
- On failure, responds with
SdkError<ListTagsError>
Source§impl Client
impl Client
Sourcepub fn modify_backup_attributes(&self) -> ModifyBackupAttributesFluentBuilder
pub fn modify_backup_attributes(&self) -> ModifyBackupAttributesFluentBuilder
Constructs a fluent builder for the ModifyBackupAttributes
operation.
- The fluent builder is configurable:
backup_id(impl Into<String>)
/set_backup_id(Option<String>)
:
required: trueThe identifier (ID) of the backup to modify. To find the ID of a backup, use the
DescribeBackups
operation.never_expires(bool)
/set_never_expires(Option<bool>)
:
required: trueSpecifies whether the service should exempt a backup from the retention policy for the cluster.
True
exempts a backup from the retention policy.False
means the service applies the backup retention policy defined at the cluster.
- On success, responds with
ModifyBackupAttributesOutput
with field(s):backup(Option<Backup>)
:Contains information about a backup of an CloudHSM cluster. All backup objects contain the
BackupId
,BackupState
,ClusterId
, andCreateTimestamp
parameters. Backups that were copied into a destination region additionally contain theCopyTimestamp
,SourceBackup
,SourceCluster
, andSourceRegion
parameters. A backup that is pending deletion will include theDeleteTimestamp
parameter.
- On failure, responds with
SdkError<ModifyBackupAttributesError>
Source§impl Client
impl Client
Sourcepub fn modify_cluster(&self) -> ModifyClusterFluentBuilder
pub fn modify_cluster(&self) -> ModifyClusterFluentBuilder
Constructs a fluent builder for the ModifyCluster
operation.
- The fluent builder is configurable:
hsm_type(impl Into<String>)
/set_hsm_type(Option<String>)
:
required: falseThe desired HSM type of the cluster.
backup_retention_policy(BackupRetentionPolicy)
/set_backup_retention_policy(Option<BackupRetentionPolicy>)
:
required: falseA policy that defines how the service retains backups.
cluster_id(impl Into<String>)
/set_cluster_id(Option<String>)
:
required: trueThe identifier (ID) of the cluster that you want to modify. To find the cluster ID, use
DescribeClusters
.
- On success, responds with
ModifyClusterOutput
with field(s):cluster(Option<Cluster>)
:Contains information about an CloudHSM cluster.
- On failure, responds with
SdkError<ModifyClusterError>
Source§impl Client
impl Client
Sourcepub fn put_resource_policy(&self) -> PutResourcePolicyFluentBuilder
pub fn put_resource_policy(&self) -> PutResourcePolicyFluentBuilder
Constructs a fluent builder for the PutResourcePolicy
operation.
- The fluent builder is configurable:
resource_arn(impl Into<String>)
/set_resource_arn(Option<String>)
:
required: falseAmazon Resource Name (ARN) of the resource to which you want to attach a policy.
policy(impl Into<String>)
/set_policy(Option<String>)
:
required: falseThe policy you want to associate with a resource.
For an example policy, see Working with shared backups in the CloudHSM User Guide
- On success, responds with
PutResourcePolicyOutput
with field(s):resource_arn(Option<String>)
:Amazon Resource Name (ARN) of the resource to which a policy is attached.
policy(Option<String>)
:The policy attached to a resource.
- On failure, responds with
SdkError<PutResourcePolicyError>
Source§impl Client
impl Client
Sourcepub fn restore_backup(&self) -> RestoreBackupFluentBuilder
pub fn restore_backup(&self) -> RestoreBackupFluentBuilder
Constructs a fluent builder for the RestoreBackup
operation.
- The fluent builder is configurable:
backup_id(impl Into<String>)
/set_backup_id(Option<String>)
:
required: trueThe ID of the backup to be restored. To find the ID of a backup, use the
DescribeBackups
operation.
- On success, responds with
RestoreBackupOutput
with field(s):backup(Option<Backup>)
:Information on the
Backup
object created.
- On failure, responds with
SdkError<RestoreBackupError>
Source§impl Client
impl Client
Sourcepub fn tag_resource(&self) -> TagResourceFluentBuilder
pub fn tag_resource(&self) -> TagResourceFluentBuilder
Constructs a fluent builder for the TagResource
operation.
- The fluent builder is configurable:
resource_id(impl Into<String>)
/set_resource_id(Option<String>)
:
required: trueThe cluster identifier (ID) for the cluster that you are tagging. To find the cluster ID, use
DescribeClusters
.tag_list(Tag)
/set_tag_list(Option<Vec::<Tag>>)
:
required: trueA list of one or more tags.
- On success, responds with
TagResourceOutput
- On failure, responds with
SdkError<TagResourceError>
Source§impl Client
impl Client
Sourcepub fn untag_resource(&self) -> UntagResourceFluentBuilder
pub fn untag_resource(&self) -> UntagResourceFluentBuilder
Constructs a fluent builder for the UntagResource
operation.
- The fluent builder is configurable:
resource_id(impl Into<String>)
/set_resource_id(Option<String>)
:
required: trueThe cluster identifier (ID) for the cluster whose tags you are removing. To find the cluster ID, use
DescribeClusters
.tag_key_list(impl Into<String>)
/set_tag_key_list(Option<Vec::<String>>)
:
required: trueA list of one or more tag keys for the tags that you are removing. Specify only the tag keys, not the tag values.
- On success, responds with
UntagResourceOutput
- On failure, responds with
SdkError<UntagResourceError>
Source§impl Client
impl Client
Sourcepub fn from_conf(conf: Config) -> Self
pub fn from_conf(conf: Config) -> Self
Creates a new client from the service Config
.
§Panics
This method will panic in the following cases:
- Retries or timeouts are enabled without a
sleep_impl
configured. - Identity caching is enabled without a
sleep_impl
andtime_source
configured. - No
behavior_version
is provided.
The panic message for each of these will have instructions on how to resolve them.
Source§impl Client
impl Client
Sourcepub fn new(sdk_config: &SdkConfig) -> Self
pub fn new(sdk_config: &SdkConfig) -> Self
Creates a new client from an SDK Config.
§Panics
- This method will panic if the
sdk_config
is missing an async sleep implementation. If you experience this panic, set thesleep_impl
on the Config passed into this function to fix it. - This method will panic if the
sdk_config
is missing an HTTP connector. If you experience this panic, set thehttp_connector
on the Config passed into this function to fix it. - This method will panic if no
BehaviorVersion
is provided. If you experience this panic, setbehavior_version
on the Config or enable thebehavior-version-latest
Cargo feature.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Client
impl !RefUnwindSafe for Client
impl Send for Client
impl Sync for Client
impl Unpin for Client
impl !UnwindSafe for Client
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Paint for Twhere
T: ?Sized,
impl<T> Paint for Twhere
T: ?Sized,
Source§fn fg(&self, value: Color) -> Painted<&T>
fn fg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self
with the foreground set to
value
.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like red()
and
green()
, which have the same functionality but are
pithier.
§Example
Set foreground color to white using fg()
:
use yansi::{Paint, Color};
painted.fg(Color::White);
Set foreground color to white using white()
.
use yansi::Paint;
painted.white();
Source§fn bright_black(&self) -> Painted<&T>
fn bright_black(&self) -> Painted<&T>
Source§fn bright_red(&self) -> Painted<&T>
fn bright_red(&self) -> Painted<&T>
Source§fn bright_green(&self) -> Painted<&T>
fn bright_green(&self) -> Painted<&T>
Source§fn bright_yellow(&self) -> Painted<&T>
fn bright_yellow(&self) -> Painted<&T>
Source§fn bright_blue(&self) -> Painted<&T>
fn bright_blue(&self) -> Painted<&T>
Source§fn bright_magenta(&self) -> Painted<&T>
fn bright_magenta(&self) -> Painted<&T>
Source§fn bright_cyan(&self) -> Painted<&T>
fn bright_cyan(&self) -> Painted<&T>
Source§fn bright_white(&self) -> Painted<&T>
fn bright_white(&self) -> Painted<&T>
Source§fn bg(&self, value: Color) -> Painted<&T>
fn bg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self
with the background set to
value
.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like on_red()
and
on_green()
, which have the same functionality but
are pithier.
§Example
Set background color to red using fg()
:
use yansi::{Paint, Color};
painted.bg(Color::Red);
Set background color to red using on_red()
.
use yansi::Paint;
painted.on_red();
Source§fn on_primary(&self) -> Painted<&T>
fn on_primary(&self) -> Painted<&T>
Source§fn on_magenta(&self) -> Painted<&T>
fn on_magenta(&self) -> Painted<&T>
Source§fn on_bright_black(&self) -> Painted<&T>
fn on_bright_black(&self) -> Painted<&T>
Source§fn on_bright_red(&self) -> Painted<&T>
fn on_bright_red(&self) -> Painted<&T>
Source§fn on_bright_green(&self) -> Painted<&T>
fn on_bright_green(&self) -> Painted<&T>
Source§fn on_bright_yellow(&self) -> Painted<&T>
fn on_bright_yellow(&self) -> Painted<&T>
Source§fn on_bright_blue(&self) -> Painted<&T>
fn on_bright_blue(&self) -> Painted<&T>
Source§fn on_bright_magenta(&self) -> Painted<&T>
fn on_bright_magenta(&self) -> Painted<&T>
Source§fn on_bright_cyan(&self) -> Painted<&T>
fn on_bright_cyan(&self) -> Painted<&T>
Source§fn on_bright_white(&self) -> Painted<&T>
fn on_bright_white(&self) -> Painted<&T>
Source§fn attr(&self, value: Attribute) -> Painted<&T>
fn attr(&self, value: Attribute) -> Painted<&T>
Enables the styling Attribute
value
.
This method should be used rarely. Instead, prefer to use
attribute-specific builder methods like bold()
and
underline()
, which have the same functionality
but are pithier.
§Example
Make text bold using attr()
:
use yansi::{Paint, Attribute};
painted.attr(Attribute::Bold);
Make text bold using using bold()
.
use yansi::Paint;
painted.bold();
Source§fn rapid_blink(&self) -> Painted<&T>
fn rapid_blink(&self) -> Painted<&T>
Source§fn quirk(&self, value: Quirk) -> Painted<&T>
fn quirk(&self, value: Quirk) -> Painted<&T>
Enables the yansi
Quirk
value
.
This method should be used rarely. Instead, prefer to use quirk-specific
builder methods like mask()
and
wrap()
, which have the same functionality but are
pithier.
§Example
Enable wrapping using .quirk()
:
use yansi::{Paint, Quirk};
painted.quirk(Quirk::Wrap);
Enable wrapping using wrap()
.
use yansi::Paint;
painted.wrap();
Source§fn clear(&self) -> Painted<&T>
👎Deprecated since 1.0.1: renamed to resetting()
due to conflicts with Vec::clear()
.
The clear()
method will be removed in a future release.
fn clear(&self) -> Painted<&T>
resetting()
due to conflicts with Vec::clear()
.
The clear()
method will be removed in a future release.Source§fn whenever(&self, value: Condition) -> Painted<&T>
fn whenever(&self, value: Condition) -> Painted<&T>
Conditionally enable styling based on whether the Condition
value
applies. Replaces any previous condition.
See the crate level docs for more details.
§Example
Enable styling painted
only when both stdout
and stderr
are TTYs:
use yansi::{Paint, Condition};
painted.red().on_yellow().whenever(Condition::STDOUTERR_ARE_TTY);