pub struct Client { /* private fields */ }
Expand description
Client for Amazon CloudHSM
Client for invoking operations on Amazon CloudHSM. Each operation on Amazon CloudHSM 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_cloudhsm::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_cloudhsm::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 AddTagsToResource
operation has
a Client::add_tags_to_resource
, 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.add_tags_to_resource()
.resource_arn("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
👎Deprecated: This API is deprecated.
Constructs a fluent builder for the AddTagsToResource
operation.
- The fluent builder is configurable:
resource_arn(impl Into<String>)
/set_resource_arn(Option<String>)
:
required: trueThe Amazon Resource Name (ARN) of the AWS CloudHSM resource to tag.
tag_list(Tag)
/set_tag_list(Option<Vec::<Tag>>)
:
required: trueOne or more tags.
- On success, responds with
AddTagsToResourceOutput
with field(s):status(String)
:The status of the operation.
- On failure, responds with
SdkError<AddTagsToResourceError>
Source§impl Client
impl Client
Sourcepub fn create_hapg(&self) -> CreateHapgFluentBuilder
👎Deprecated: This API is deprecated.
pub fn create_hapg(&self) -> CreateHapgFluentBuilder
Constructs a fluent builder for the CreateHapg
operation.
- The fluent builder is configurable:
label(impl Into<String>)
/set_label(Option<String>)
:
required: trueThe label of the new high-availability partition group.
- On success, responds with
CreateHapgOutput
with field(s):hapg_arn(Option<String>)
:The ARN of the high-availability partition group.
- On failure, responds with
SdkError<CreateHapgError>
Source§impl Client
impl Client
Sourcepub fn create_hsm(&self) -> CreateHsmFluentBuilder
👎Deprecated: This API is deprecated.
pub fn create_hsm(&self) -> CreateHsmFluentBuilder
Constructs a fluent builder for the CreateHsm
operation.
- The fluent builder is configurable:
subnet_id(impl Into<String>)
/set_subnet_id(Option<String>)
:
required: trueThe identifier of the subnet in your VPC in which to place the HSM.
ssh_key(impl Into<String>)
/set_ssh_key(Option<String>)
:
required: trueThe SSH public key to install on the HSM.
eni_ip(impl Into<String>)
/set_eni_ip(Option<String>)
:
required: falseThe IP address to assign to the HSM’s ENI.
If an IP address is not specified, an IP address will be randomly chosen from the CIDR range of the subnet.
iam_role_arn(impl Into<String>)
/set_iam_role_arn(Option<String>)
:
required: trueThe ARN of an IAM role to enable the AWS CloudHSM service to allocate an ENI on your behalf.
external_id(impl Into<String>)
/set_external_id(Option<String>)
:
required: falseThe external ID from
IamRoleArn
, if present.subscription_type(SubscriptionType)
/set_subscription_type(Option<SubscriptionType>)
:
required: trueSpecifies the type of subscription for the HSM.
-
PRODUCTION - The HSM is being used in a production environment.
-
TRIAL - The HSM is being used in a product trial.
-
client_token(impl Into<String>)
/set_client_token(Option<String>)
:
required: falseA user-defined token to ensure idempotence. Subsequent calls to this operation with the same token will be ignored.
syslog_ip(impl Into<String>)
/set_syslog_ip(Option<String>)
:
required: falseThe IP address for the syslog monitoring server. The AWS CloudHSM service only supports one syslog monitoring server.
- On success, responds with
CreateHsmOutput
with field(s):hsm_arn(Option<String>)
:The ARN of the HSM.
- On failure, responds with
SdkError<CreateHsmError>
Source§impl Client
impl Client
Sourcepub fn create_luna_client(&self) -> CreateLunaClientFluentBuilder
👎Deprecated: This API is deprecated.
pub fn create_luna_client(&self) -> CreateLunaClientFluentBuilder
Constructs a fluent builder for the CreateLunaClient
operation.
- The fluent builder is configurable:
label(impl Into<String>)
/set_label(Option<String>)
:
required: falseThe label for the client.
certificate(impl Into<String>)
/set_certificate(Option<String>)
:
required: trueThe contents of a Base64-Encoded X.509 v3 certificate to be installed on the HSMs used by this client.
- On success, responds with
CreateLunaClientOutput
with field(s):client_arn(Option<String>)
:The ARN of the client.
- On failure, responds with
SdkError<CreateLunaClientError>
Source§impl Client
impl Client
Sourcepub fn delete_hapg(&self) -> DeleteHapgFluentBuilder
👎Deprecated: This API is deprecated.
pub fn delete_hapg(&self) -> DeleteHapgFluentBuilder
Constructs a fluent builder for the DeleteHapg
operation.
- The fluent builder is configurable:
hapg_arn(impl Into<String>)
/set_hapg_arn(Option<String>)
:
required: trueThe ARN of the high-availability partition group to delete.
- On success, responds with
DeleteHapgOutput
with field(s):status(String)
:The status of the action.
- On failure, responds with
SdkError<DeleteHapgError>
Source§impl Client
impl Client
Sourcepub fn delete_hsm(&self) -> DeleteHsmFluentBuilder
👎Deprecated: This API is deprecated.
pub fn delete_hsm(&self) -> DeleteHsmFluentBuilder
Constructs a fluent builder for the DeleteHsm
operation.
- The fluent builder is configurable:
hsm_arn(impl Into<String>)
/set_hsm_arn(Option<String>)
:
required: trueThe ARN of the HSM to delete.
- On success, responds with
DeleteHsmOutput
with field(s):status(String)
:The status of the operation.
- On failure, responds with
SdkError<DeleteHsmError>
Source§impl Client
impl Client
Sourcepub fn delete_luna_client(&self) -> DeleteLunaClientFluentBuilder
👎Deprecated: This API is deprecated.
pub fn delete_luna_client(&self) -> DeleteLunaClientFluentBuilder
Constructs a fluent builder for the DeleteLunaClient
operation.
- The fluent builder is configurable:
client_arn(impl Into<String>)
/set_client_arn(Option<String>)
:
required: trueThe ARN of the client to delete.
- On success, responds with
DeleteLunaClientOutput
with field(s):status(String)
:The status of the action.
- On failure, responds with
SdkError<DeleteLunaClientError>
Source§impl Client
impl Client
Sourcepub fn describe_hapg(&self) -> DescribeHapgFluentBuilder
👎Deprecated: This API is deprecated.
pub fn describe_hapg(&self) -> DescribeHapgFluentBuilder
Constructs a fluent builder for the DescribeHapg
operation.
- The fluent builder is configurable:
hapg_arn(impl Into<String>)
/set_hapg_arn(Option<String>)
:
required: trueThe ARN of the high-availability partition group to describe.
- On success, responds with
DescribeHapgOutput
with field(s):hapg_arn(Option<String>)
:The ARN of the high-availability partition group.
hapg_serial(Option<String>)
:The serial number of the high-availability partition group.
hsms_last_action_failed(Option<Vec::<String>>)
:hsms_pending_deletion(Option<Vec::<String>>)
:hsms_pending_registration(Option<Vec::<String>>)
:label(Option<String>)
:The label for the high-availability partition group.
last_modified_timestamp(Option<String>)
:The date and time the high-availability partition group was last modified.
partition_serial_list(Option<Vec::<String>>)
:The list of partition serial numbers that belong to the high-availability partition group.
state(Option<CloudHsmObjectState>)
:The state of the high-availability partition group.
- On failure, responds with
SdkError<DescribeHapgError>
Source§impl Client
impl Client
Sourcepub fn describe_hsm(&self) -> DescribeHsmFluentBuilder
👎Deprecated: This API is deprecated.
pub fn describe_hsm(&self) -> DescribeHsmFluentBuilder
Constructs a fluent builder for the DescribeHsm
operation.
- The fluent builder is configurable:
hsm_arn(impl Into<String>)
/set_hsm_arn(Option<String>)
:
required: falseThe ARN of the HSM. Either the
HsmArn
or theSerialNumber
parameter must be specified.hsm_serial_number(impl Into<String>)
/set_hsm_serial_number(Option<String>)
:
required: falseThe serial number of the HSM. Either the
HsmArn
or theHsmSerialNumber
parameter must be specified.
- On success, responds with
DescribeHsmOutput
with field(s):hsm_arn(Option<String>)
:The ARN of the HSM.
status(Option<HsmStatus>)
:The status of the HSM.
status_details(Option<String>)
:Contains additional information about the status of the HSM.
availability_zone(Option<String>)
:The Availability Zone that the HSM is in.
eni_id(Option<String>)
:The identifier of the elastic network interface (ENI) attached to the HSM.
eni_ip(Option<String>)
:The IP address assigned to the HSM’s ENI.
subscription_type(Option<SubscriptionType>)
:Specifies the type of subscription for the HSM.
-
PRODUCTION - The HSM is being used in a production environment.
-
TRIAL - The HSM is being used in a product trial.
-
subscription_start_date(Option<String>)
:The subscription start date.
subscription_end_date(Option<String>)
:The subscription end date.
vpc_id(Option<String>)
:The identifier of the VPC that the HSM is in.
subnet_id(Option<String>)
:The identifier of the subnet that the HSM is in.
iam_role_arn(Option<String>)
:The ARN of the IAM role assigned to the HSM.
serial_number(Option<String>)
:The serial number of the HSM.
vendor_name(Option<String>)
:The name of the HSM vendor.
hsm_type(Option<String>)
:The HSM model type.
software_version(Option<String>)
:The HSM software version.
ssh_public_key(Option<String>)
:The public SSH key.
ssh_key_last_updated(Option<String>)
:The date and time that the SSH key was last updated.
server_cert_uri(Option<String>)
:The URI of the certificate server.
server_cert_last_updated(Option<String>)
:The date and time that the server certificate was last updated.
partitions(Option<Vec::<String>>)
:The list of partitions on the HSM.
- On failure, responds with
SdkError<DescribeHsmError>
Source§impl Client
impl Client
Sourcepub fn describe_luna_client(&self) -> DescribeLunaClientFluentBuilder
👎Deprecated: This API is deprecated.
pub fn describe_luna_client(&self) -> DescribeLunaClientFluentBuilder
Constructs a fluent builder for the DescribeLunaClient
operation.
- The fluent builder is configurable:
client_arn(impl Into<String>)
/set_client_arn(Option<String>)
:
required: falseThe ARN of the client.
certificate_fingerprint(impl Into<String>)
/set_certificate_fingerprint(Option<String>)
:
required: falseThe certificate fingerprint.
- On success, responds with
DescribeLunaClientOutput
with field(s):client_arn(Option<String>)
:The ARN of the client.
certificate(Option<String>)
:The certificate installed on the HSMs used by this client.
certificate_fingerprint(Option<String>)
:The certificate fingerprint.
last_modified_timestamp(Option<String>)
:The date and time the client was last modified.
label(Option<String>)
:The label of the client.
- On failure, responds with
SdkError<DescribeLunaClientError>
Source§impl Client
impl Client
Sourcepub fn get_config(&self) -> GetConfigFluentBuilder
👎Deprecated: This API is deprecated.
pub fn get_config(&self) -> GetConfigFluentBuilder
Constructs a fluent builder for the GetConfig
operation.
- The fluent builder is configurable:
client_arn(impl Into<String>)
/set_client_arn(Option<String>)
:
required: trueThe ARN of the client.
client_version(ClientVersion)
/set_client_version(Option<ClientVersion>)
:
required: trueThe client version.
hapg_list(impl Into<String>)
/set_hapg_list(Option<Vec::<String>>)
:
required: trueA list of ARNs that identify the high-availability partition groups that are associated with the client.
- On success, responds with
GetConfigOutput
with field(s):config_type(Option<String>)
:The type of credentials.
config_file(Option<String>)
:The chrystoki.conf configuration file.
config_cred(Option<String>)
:The certificate file containing the server.pem files of the HSMs.
- On failure, responds with
SdkError<GetConfigError>
Source§impl Client
impl Client
Sourcepub fn list_available_zones(&self) -> ListAvailableZonesFluentBuilder
👎Deprecated: This API is deprecated.
pub fn list_available_zones(&self) -> ListAvailableZonesFluentBuilder
Constructs a fluent builder for the ListAvailableZones
operation.
- The fluent builder takes no input, just
send
it. - On success, responds with
ListAvailableZonesOutput
with field(s):az_list(Option<Vec::<String>>)
:The list of Availability Zones that have available AWS CloudHSM capacity.
- On failure, responds with
SdkError<ListAvailableZonesError>
Source§impl Client
impl Client
Sourcepub fn list_hapgs(&self) -> ListHapgsFluentBuilder
👎Deprecated: This API is deprecated.
pub fn list_hapgs(&self) -> ListHapgsFluentBuilder
Constructs a fluent builder for the ListHapgs
operation.
- The fluent builder is configurable:
next_token(impl Into<String>)
/set_next_token(Option<String>)
:
required: falseThe
NextToken
value from a previous call toListHapgs
. Pass null if this is the first call.
- On success, responds with
ListHapgsOutput
with field(s):hapg_list(Vec::<String>)
:The list of high-availability partition groups.
next_token(Option<String>)
:If not null, more results are available. Pass this value to
ListHapgs
to retrieve the next set of items.
- On failure, responds with
SdkError<ListHapgsError>
Source§impl Client
impl Client
Sourcepub fn list_hsms(&self) -> ListHsmsFluentBuilder
👎Deprecated: This API is deprecated.
pub fn list_hsms(&self) -> ListHsmsFluentBuilder
Constructs a fluent builder for the ListHsms
operation.
- The fluent builder is configurable:
next_token(impl Into<String>)
/set_next_token(Option<String>)
:
required: falseThe
NextToken
value from a previous call toListHsms
. Pass null if this is the first call.
- On success, responds with
ListHsmsOutput
with field(s):hsm_list(Option<Vec::<String>>)
:The list of ARNs that identify the HSMs.
next_token(Option<String>)
:If not null, more results are available. Pass this value to
ListHsms
to retrieve the next set of items.
- On failure, responds with
SdkError<ListHsmsError>
Source§impl Client
impl Client
Sourcepub fn list_luna_clients(&self) -> ListLunaClientsFluentBuilder
👎Deprecated: This API is deprecated.
pub fn list_luna_clients(&self) -> ListLunaClientsFluentBuilder
Constructs a fluent builder for the ListLunaClients
operation.
- The fluent builder is configurable:
next_token(impl Into<String>)
/set_next_token(Option<String>)
:
required: falseThe
NextToken
value from a previous call toListLunaClients
. Pass null if this is the first call.
- On success, responds with
ListLunaClientsOutput
with field(s):client_list(Vec::<String>)
:The list of clients.
next_token(Option<String>)
:If not null, more results are available. Pass this to
ListLunaClients
to retrieve the next set of items.
- On failure, responds with
SdkError<ListLunaClientsError>
Source§impl Client
impl Client
👎Deprecated: This API is deprecated.
Constructs a fluent builder for the ListTagsForResource
operation.
- The fluent builder is configurable:
resource_arn(impl Into<String>)
/set_resource_arn(Option<String>)
:
required: trueThe Amazon Resource Name (ARN) of the AWS CloudHSM resource.
- On success, responds with
ListTagsForResourceOutput
with field(s):tag_list(Vec::<Tag>)
:One or more tags.
- On failure, responds with
SdkError<ListTagsForResourceError>
Source§impl Client
impl Client
Sourcepub fn modify_hapg(&self) -> ModifyHapgFluentBuilder
👎Deprecated: This API is deprecated.
pub fn modify_hapg(&self) -> ModifyHapgFluentBuilder
Constructs a fluent builder for the ModifyHapg
operation.
- The fluent builder is configurable:
hapg_arn(impl Into<String>)
/set_hapg_arn(Option<String>)
:
required: trueThe ARN of the high-availability partition group to modify.
label(impl Into<String>)
/set_label(Option<String>)
:
required: falseThe new label for the high-availability partition group.
partition_serial_list(impl Into<String>)
/set_partition_serial_list(Option<Vec::<String>>)
:
required: falseThe list of partition serial numbers to make members of the high-availability partition group.
- On success, responds with
ModifyHapgOutput
with field(s):hapg_arn(Option<String>)
:The ARN of the high-availability partition group.
- On failure, responds with
SdkError<ModifyHapgError>
Source§impl Client
impl Client
Sourcepub fn modify_hsm(&self) -> ModifyHsmFluentBuilder
👎Deprecated: This API is deprecated.
pub fn modify_hsm(&self) -> ModifyHsmFluentBuilder
Constructs a fluent builder for the ModifyHsm
operation.
- The fluent builder is configurable:
hsm_arn(impl Into<String>)
/set_hsm_arn(Option<String>)
:
required: trueThe ARN of the HSM to modify.
subnet_id(impl Into<String>)
/set_subnet_id(Option<String>)
:
required: falseThe new identifier of the subnet that the HSM is in. The new subnet must be in the same Availability Zone as the current subnet.
eni_ip(impl Into<String>)
/set_eni_ip(Option<String>)
:
required: falseThe new IP address for the elastic network interface (ENI) attached to the HSM.
If the HSM is moved to a different subnet, and an IP address is not specified, an IP address will be randomly chosen from the CIDR range of the new subnet.
iam_role_arn(impl Into<String>)
/set_iam_role_arn(Option<String>)
:
required: falseThe new IAM role ARN.
external_id(impl Into<String>)
/set_external_id(Option<String>)
:
required: falseThe new external ID.
syslog_ip(impl Into<String>)
/set_syslog_ip(Option<String>)
:
required: falseThe new IP address for the syslog monitoring server. The AWS CloudHSM service only supports one syslog monitoring server.
- On success, responds with
ModifyHsmOutput
with field(s):hsm_arn(Option<String>)
:The ARN of the HSM.
- On failure, responds with
SdkError<ModifyHsmError>
Source§impl Client
impl Client
Sourcepub fn modify_luna_client(&self) -> ModifyLunaClientFluentBuilder
👎Deprecated: This API is deprecated.
pub fn modify_luna_client(&self) -> ModifyLunaClientFluentBuilder
Constructs a fluent builder for the ModifyLunaClient
operation.
- The fluent builder is configurable:
client_arn(impl Into<String>)
/set_client_arn(Option<String>)
:
required: trueThe ARN of the client.
certificate(impl Into<String>)
/set_certificate(Option<String>)
:
required: trueThe new certificate for the client.
- On success, responds with
ModifyLunaClientOutput
with field(s):client_arn(Option<String>)
:The ARN of the client.
- On failure, responds with
SdkError<ModifyLunaClientError>
Source§impl Client
impl Client
👎Deprecated: This API is deprecated.
Constructs a fluent builder for the RemoveTagsFromResource
operation.
- The fluent builder is configurable:
resource_arn(impl Into<String>)
/set_resource_arn(Option<String>)
:
required: trueThe Amazon Resource Name (ARN) of the AWS CloudHSM resource.
tag_key_list(impl Into<String>)
/set_tag_key_list(Option<Vec::<String>>)
:
required: trueThe tag key or keys to remove.
Specify only the tag key to remove (not the value). To overwrite the value for an existing tag, use
AddTagsToResource
.
- On success, responds with
RemoveTagsFromResourceOutput
with field(s):status(String)
:The status of the operation.
- On failure, responds with
SdkError<RemoveTagsFromResourceError>
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);