pub struct Client { /* private fields */ }
Expand description
Client for AWS Certificate Manager
Client for invoking operations on AWS Certificate Manager. Each operation on AWS Certificate Manager 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_acm::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_acm::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 AddTagsToCertificate
operation has
a Client::add_tags_to_certificate
, 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_certificate()
.certificate_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.
§Waiters
This client provides wait_until
methods behind the Waiters
trait.
To use them, simply import the trait, and then call one of the wait_until
methods. This will
return a waiter fluent builder that takes various parameters, which are documented on the builder
type. Once parameters have been provided, the wait
method can be called to initiate waiting.
For example, if there was a wait_until_thing
method, it could look like:
let result = client.wait_until_thing()
.thing_id("someId")
.wait(Duration::from_secs(120))
.await;
Implementations§
Source§impl Client
impl Client
Constructs a fluent builder for the AddTagsToCertificate
operation.
- The fluent builder is configurable:
certificate_arn(impl Into<String>)
/set_certificate_arn(Option<String>)
:
required: trueString that contains the ARN of the ACM certificate to which the tag is to be applied. This must be of the form:
arn:aws:acm:region:123456789012:certificate/12345678-1234-1234-1234-123456789012
For more information about ARNs, see Amazon Resource Names (ARNs).
tags(Tag)
/set_tags(Option<Vec::<Tag>>)
:
required: trueThe key-value pair that defines the tag. The tag value is optional.
- On success, responds with
AddTagsToCertificateOutput
- On failure, responds with
SdkError<AddTagsToCertificateError>
Source§impl Client
impl Client
Sourcepub fn delete_certificate(&self) -> DeleteCertificateFluentBuilder
pub fn delete_certificate(&self) -> DeleteCertificateFluentBuilder
Constructs a fluent builder for the DeleteCertificate
operation.
- The fluent builder is configurable:
certificate_arn(impl Into<String>)
/set_certificate_arn(Option<String>)
:
required: trueString that contains the ARN of the ACM certificate to be deleted. This must be of the form:
arn:aws:acm:region:123456789012:certificate/12345678-1234-1234-1234-123456789012
For more information about ARNs, see Amazon Resource Names (ARNs).
- On success, responds with
DeleteCertificateOutput
- On failure, responds with
SdkError<DeleteCertificateError>
Source§impl Client
impl Client
Sourcepub fn describe_certificate(&self) -> DescribeCertificateFluentBuilder
pub fn describe_certificate(&self) -> DescribeCertificateFluentBuilder
Constructs a fluent builder for the DescribeCertificate
operation.
- The fluent builder is configurable:
certificate_arn(impl Into<String>)
/set_certificate_arn(Option<String>)
:
required: trueThe Amazon Resource Name (ARN) of the ACM certificate. The ARN must have the following form:
arn:aws:acm:region:123456789012:certificate/12345678-1234-1234-1234-123456789012
For more information about ARNs, see Amazon Resource Names (ARNs).
- On success, responds with
DescribeCertificateOutput
with field(s):certificate(Option<CertificateDetail>)
:Metadata about an ACM certificate.
- On failure, responds with
SdkError<DescribeCertificateError>
Source§impl Client
impl Client
Sourcepub fn export_certificate(&self) -> ExportCertificateFluentBuilder
pub fn export_certificate(&self) -> ExportCertificateFluentBuilder
Constructs a fluent builder for the ExportCertificate
operation.
- The fluent builder is configurable:
certificate_arn(impl Into<String>)
/set_certificate_arn(Option<String>)
:
required: trueAn Amazon Resource Name (ARN) of the issued certificate. This must be of the form:
arn:aws:acm:region:account:certificate/12345678-1234-1234-1234-123456789012
passphrase(Blob)
/set_passphrase(Option<Blob>)
:
required: truePassphrase to associate with the encrypted exported private key.
When creating your passphrase, you can use any ASCII character except #, $, or %.
If you want to later decrypt the private key, you must have the passphrase. You can use the following OpenSSL command to decrypt a private key. After entering the command, you are prompted for the passphrase.
openssl rsa -in encrypted_key.pem -out decrypted_key.pem
- On success, responds with
ExportCertificateOutput
with field(s):certificate(Option<String>)
:The base64 PEM-encoded certificate.
certificate_chain(Option<String>)
:The base64 PEM-encoded certificate chain. This does not include the certificate that you are exporting.
private_key(Option<String>)
:The encrypted private key associated with the public key in the certificate. The key is output in PKCS #8 format and is base64 PEM-encoded.
- On failure, responds with
SdkError<ExportCertificateError>
Source§impl Client
impl Client
Sourcepub fn get_account_configuration(&self) -> GetAccountConfigurationFluentBuilder
pub fn get_account_configuration(&self) -> GetAccountConfigurationFluentBuilder
Constructs a fluent builder for the GetAccountConfiguration
operation.
- The fluent builder takes no input, just
send
it. - On success, responds with
GetAccountConfigurationOutput
with field(s):expiry_events(Option<ExpiryEventsConfiguration>)
:Expiration events configuration options associated with the Amazon Web Services account.
- On failure, responds with
SdkError<GetAccountConfigurationError>
Source§impl Client
impl Client
Sourcepub fn get_certificate(&self) -> GetCertificateFluentBuilder
pub fn get_certificate(&self) -> GetCertificateFluentBuilder
Constructs a fluent builder for the GetCertificate
operation.
- The fluent builder is configurable:
certificate_arn(impl Into<String>)
/set_certificate_arn(Option<String>)
:
required: trueString that contains a certificate ARN in the following format:
arn:aws:acm:region:123456789012:certificate/12345678-1234-1234-1234-123456789012
For more information about ARNs, see Amazon Resource Names (ARNs).
- On success, responds with
GetCertificateOutput
with field(s):certificate(Option<String>)
:The ACM-issued certificate corresponding to the ARN specified as input.
certificate_chain(Option<String>)
:Certificates forming the requested certificate’s chain of trust. The chain consists of the certificate of the issuing CA and the intermediate certificates of any other subordinate CAs.
- On failure, responds with
SdkError<GetCertificateError>
Source§impl Client
impl Client
Sourcepub fn import_certificate(&self) -> ImportCertificateFluentBuilder
pub fn import_certificate(&self) -> ImportCertificateFluentBuilder
Constructs a fluent builder for the ImportCertificate
operation.
- The fluent builder is configurable:
certificate_arn(impl Into<String>)
/set_certificate_arn(Option<String>)
:
required: falseThe Amazon Resource Name (ARN) of an imported certificate to replace. To import a new certificate, omit this field.
certificate(Blob)
/set_certificate(Option<Blob>)
:
required: trueThe certificate to import.
private_key(Blob)
/set_private_key(Option<Blob>)
:
required: trueThe private key that matches the public key in the certificate.
certificate_chain(Blob)
/set_certificate_chain(Option<Blob>)
:
required: falseThe PEM encoded certificate chain.
tags(Tag)
/set_tags(Option<Vec::<Tag>>)
:
required: falseOne or more resource tags to associate with the imported certificate.
Note: You cannot apply tags when reimporting a certificate.
- On success, responds with
ImportCertificateOutput
with field(s):certificate_arn(Option<String>)
:The Amazon Resource Name (ARN) of the imported certificate.
- On failure, responds with
SdkError<ImportCertificateError>
Source§impl Client
impl Client
Sourcepub fn list_certificates(&self) -> ListCertificatesFluentBuilder
pub fn list_certificates(&self) -> ListCertificatesFluentBuilder
Constructs a fluent builder for the ListCertificates
operation.
This operation supports pagination; See into_paginator()
.
- The fluent builder is configurable:
certificate_statuses(CertificateStatus)
/set_certificate_statuses(Option<Vec::<CertificateStatus>>)
:
required: falseFilter the certificate list by status value.
includes(Filters)
/set_includes(Option<Filters>)
:
required: falseFilter the certificate list. For more information, see the
Filters
structure.next_token(impl Into<String>)
/set_next_token(Option<String>)
:
required: falseUse this parameter only when paginating results and only in a subsequent request after you receive a response with truncated results. Set it to the value of
NextToken
from the response you just received.max_items(i32)
/set_max_items(Option<i32>)
:
required: falseUse this parameter when paginating results to specify the maximum number of items to return in the response. If additional items exist beyond the number you specify, the
NextToken
element is sent in the response. Use thisNextToken
value in a subsequent request to retrieve additional items.sort_by(SortBy)
/set_sort_by(Option<SortBy>)
:
required: falseSpecifies the field to sort results by. If you specify
SortBy
, you must also specifySortOrder
.sort_order(SortOrder)
/set_sort_order(Option<SortOrder>)
:
required: falseSpecifies the order of sorted results. If you specify
SortOrder
, you must also specifySortBy
.
- On success, responds with
ListCertificatesOutput
with field(s):next_token(Option<String>)
:When the list is truncated, this value is present and contains the value to use for the
NextToken
parameter in a subsequent pagination request.certificate_summary_list(Option<Vec::<CertificateSummary>>)
:A list of ACM certificates.
- On failure, responds with
SdkError<ListCertificatesError>
Source§impl Client
impl Client
Constructs a fluent builder for the ListTagsForCertificate
operation.
- The fluent builder is configurable:
certificate_arn(impl Into<String>)
/set_certificate_arn(Option<String>)
:
required: trueString that contains the ARN of the ACM certificate for which you want to list the tags. This must have the following form:
arn:aws:acm:region:123456789012:certificate/12345678-1234-1234-1234-123456789012
For more information about ARNs, see Amazon Resource Names (ARNs).
- On success, responds with
ListTagsForCertificateOutput
with field(s):tags(Option<Vec::<Tag>>)
:The key-value pairs that define the applied tags.
- On failure, responds with
SdkError<ListTagsForCertificateError>
Source§impl Client
impl Client
Sourcepub fn put_account_configuration(&self) -> PutAccountConfigurationFluentBuilder
pub fn put_account_configuration(&self) -> PutAccountConfigurationFluentBuilder
Constructs a fluent builder for the PutAccountConfiguration
operation.
- The fluent builder is configurable:
expiry_events(ExpiryEventsConfiguration)
/set_expiry_events(Option<ExpiryEventsConfiguration>)
:
required: falseSpecifies expiration events associated with an account.
idempotency_token(impl Into<String>)
/set_idempotency_token(Option<String>)
:
required: trueCustomer-chosen string used to distinguish between calls to
PutAccountConfiguration
. Idempotency tokens time out after one hour. If you callPutAccountConfiguration
multiple times with the same unexpired idempotency token, ACM treats it as the same request and returns the original result. If you change the idempotency token for each call, ACM treats each call as a new request.
- On success, responds with
PutAccountConfigurationOutput
- On failure, responds with
SdkError<PutAccountConfigurationError>
Source§impl Client
impl Client
Constructs a fluent builder for the RemoveTagsFromCertificate
operation.
- The fluent builder is configurable:
certificate_arn(impl Into<String>)
/set_certificate_arn(Option<String>)
:
required: trueString that contains the ARN of the ACM Certificate with one or more tags that you want to remove. This must be of the form:
arn:aws:acm:region:123456789012:certificate/12345678-1234-1234-1234-123456789012
For more information about ARNs, see Amazon Resource Names (ARNs).
tags(Tag)
/set_tags(Option<Vec::<Tag>>)
:
required: trueThe key-value pair that defines the tag to remove.
- On success, responds with
RemoveTagsFromCertificateOutput
- On failure, responds with
SdkError<RemoveTagsFromCertificateError>
Source§impl Client
impl Client
Sourcepub fn renew_certificate(&self) -> RenewCertificateFluentBuilder
pub fn renew_certificate(&self) -> RenewCertificateFluentBuilder
Constructs a fluent builder for the RenewCertificate
operation.
- The fluent builder is configurable:
certificate_arn(impl Into<String>)
/set_certificate_arn(Option<String>)
:
required: trueString that contains the ARN of the ACM certificate to be renewed. This must be of the form:
arn:aws:acm:region:123456789012:certificate/12345678-1234-1234-1234-123456789012
For more information about ARNs, see Amazon Resource Names (ARNs).
- On success, responds with
RenewCertificateOutput
- On failure, responds with
SdkError<RenewCertificateError>
Source§impl Client
impl Client
Sourcepub fn request_certificate(&self) -> RequestCertificateFluentBuilder
pub fn request_certificate(&self) -> RequestCertificateFluentBuilder
Constructs a fluent builder for the RequestCertificate
operation.
- The fluent builder is configurable:
domain_name(impl Into<String>)
/set_domain_name(Option<String>)
:
required: trueFully qualified domain name (FQDN), such as www.example.com, that you want to secure with an ACM certificate. Use an asterisk (*) to create a wildcard certificate that protects several sites in the same domain. For example, *.example.com protects www.example.com, site.example.com, and images.example.com.
In compliance with RFC 5280, the length of the domain name (technically, the Common Name) that you provide cannot exceed 64 octets (characters), including periods. To add a longer domain name, specify it in the Subject Alternative Name field, which supports names up to 253 octets in length.
validation_method(ValidationMethod)
/set_validation_method(Option<ValidationMethod>)
:
required: falseThe method you want to use if you are requesting a public certificate to validate that you own or control domain. You can validate with DNS or validate with email. We recommend that you use DNS validation.
subject_alternative_names(impl Into<String>)
/set_subject_alternative_names(Option<Vec::<String>>)
:
required: falseAdditional FQDNs to be included in the Subject Alternative Name extension of the ACM certificate. For example, add the name www.example.net to a certificate for which the
DomainName
field is www.example.com if users can reach your site by using either name. The maximum number of domain names that you can add to an ACM certificate is 100. However, the initial quota is 10 domain names. If you need more than 10 names, you must request a quota increase. For more information, see Quotas.The maximum length of a SAN DNS name is 253 octets. The name is made up of multiple labels separated by periods. No label can be longer than 63 octets. Consider the following examples:
-
(63 octets).(63 octets).(63 octets).(61 octets)
is legal because the total length is 253 octets (63+1+63+1+63+1+61) and no label exceeds 63 octets. -
(64 octets).(63 octets).(63 octets).(61 octets)
is not legal because the total length exceeds 253 octets (64+1+63+1+63+1+61) and the first label exceeds 63 octets. -
(63 octets).(63 octets).(63 octets).(62 octets)
is not legal because the total length of the DNS name (63+1+63+1+63+1+62) exceeds 253 octets.
-
idempotency_token(impl Into<String>)
/set_idempotency_token(Option<String>)
:
required: falseCustomer chosen string that can be used to distinguish between calls to
RequestCertificate
. Idempotency tokens time out after one hour. Therefore, if you callRequestCertificate
multiple times with the same idempotency token within one hour, ACM recognizes that you are requesting only one certificate and will issue only one. If you change the idempotency token for each call, ACM recognizes that you are requesting multiple certificates.domain_validation_options(DomainValidationOption)
/set_domain_validation_options(Option<Vec::<DomainValidationOption>>)
:
required: falseThe domain name that you want ACM to use to send you emails so that you can validate domain ownership.
options(CertificateOptions)
/set_options(Option<CertificateOptions>)
:
required: falseCurrently, you can use this parameter to specify whether to add the certificate to a certificate transparency log. Certificate transparency makes it possible to detect SSL/TLS certificates that have been mistakenly or maliciously issued. Certificates that have not been logged typically produce an error message in a browser. For more information, see Opting Out of Certificate Transparency Logging.
certificate_authority_arn(impl Into<String>)
/set_certificate_authority_arn(Option<String>)
:
required: falseThe Amazon Resource Name (ARN) of the private certificate authority (CA) that will be used to issue the certificate. If you do not provide an ARN and you are trying to request a private certificate, ACM will attempt to issue a public certificate. For more information about private CAs, see the Amazon Web Services Private Certificate Authority user guide. The ARN must have the following form:
arn:aws:acm-pca:region:account:certificate-authority/12345678-1234-1234-1234-123456789012
tags(Tag)
/set_tags(Option<Vec::<Tag>>)
:
required: falseOne or more resource tags to associate with the certificate.
key_algorithm(KeyAlgorithm)
/set_key_algorithm(Option<KeyAlgorithm>)
:
required: falseSpecifies the algorithm of the public and private key pair that your certificate uses to encrypt data. RSA is the default key algorithm for ACM certificates. Elliptic Curve Digital Signature Algorithm (ECDSA) keys are smaller, offering security comparable to RSA keys but with greater computing efficiency. However, ECDSA is not supported by all network clients. Some Amazon Web Services services may require RSA keys, or only support ECDSA keys of a particular size, while others allow the use of either RSA and ECDSA keys to ensure that compatibility is not broken. Check the requirements for the Amazon Web Services service where you plan to deploy your certificate. For more information about selecting an algorithm, see Key algorithms.
Algorithms supported for an ACM certificate request include:
-
RSA_2048
-
EC_prime256v1
-
EC_secp384r1
Other listed algorithms are for imported certificates only.
When you request a private PKI certificate signed by a CA from Amazon Web Services Private CA, the specified signing algorithm family (RSA or ECDSA) must match the algorithm family of the CA’s secret key.
Default: RSA_2048
-
managed_by(CertificateManagedBy)
/set_managed_by(Option<CertificateManagedBy>)
:
required: falseIdentifies the Amazon Web Services service that manages the certificate issued by ACM.
- On success, responds with
RequestCertificateOutput
with field(s):certificate_arn(Option<String>)
:String that contains the ARN of the issued certificate. This must be of the form:
arn:aws:acm:us-east-1:123456789012:certificate/12345678-1234-1234-1234-123456789012
- On failure, responds with
SdkError<RequestCertificateError>
Source§impl Client
impl Client
Sourcepub fn resend_validation_email(&self) -> ResendValidationEmailFluentBuilder
pub fn resend_validation_email(&self) -> ResendValidationEmailFluentBuilder
Constructs a fluent builder for the ResendValidationEmail
operation.
- The fluent builder is configurable:
certificate_arn(impl Into<String>)
/set_certificate_arn(Option<String>)
:
required: trueString that contains the ARN of the requested certificate. The certificate ARN is generated and returned by the
RequestCertificate
action as soon as the request is made. By default, using this parameter causes email to be sent to all top-level domains you specified in the certificate request. The ARN must be of the form:arn:aws:acm:us-east-1:123456789012:certificate/12345678-1234-1234-1234-123456789012
domain(impl Into<String>)
/set_domain(Option<String>)
:
required: trueThe fully qualified domain name (FQDN) of the certificate that needs to be validated.
validation_domain(impl Into<String>)
/set_validation_domain(Option<String>)
:
required: trueThe base validation domain that will act as the suffix of the email addresses that are used to send the emails. This must be the same as the
Domain
value or a superdomain of theDomain
value. For example, if you requested a certificate forsite.subdomain.example.com
and specify a ValidationDomain ofsubdomain.example.com
, ACM sends email to the domain registrant, technical contact, and administrative contact in WHOIS and the following five addresses:-
admin@subdomain.example.com
-
administrator@subdomain.example.com
-
hostmaster@subdomain.example.com
-
postmaster@subdomain.example.com
-
webmaster@subdomain.example.com
-
- On success, responds with
ResendValidationEmailOutput
- On failure, responds with
SdkError<ResendValidationEmailError>
Source§impl Client
impl Client
Sourcepub fn update_certificate_options(
&self,
) -> UpdateCertificateOptionsFluentBuilder
pub fn update_certificate_options( &self, ) -> UpdateCertificateOptionsFluentBuilder
Constructs a fluent builder for the UpdateCertificateOptions
operation.
- The fluent builder is configurable:
certificate_arn(impl Into<String>)
/set_certificate_arn(Option<String>)
:
required: trueARN of the requested certificate to update. This must be of the form:
arn:aws:acm:us-east-1:account:certificate/12345678-1234-1234-1234-123456789012
options(CertificateOptions)
/set_options(Option<CertificateOptions>)
:
required: trueUse to update the options for your certificate. Currently, you can specify whether to add your certificate to a transparency log. Certificate transparency makes it possible to detect SSL/TLS certificates that have been mistakenly or maliciously issued. Certificates that have not been logged typically produce an error message in a browser.
- On success, responds with
UpdateCertificateOptionsOutput
- On failure, responds with
SdkError<UpdateCertificateOptionsError>
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§
Source§impl Waiters for Client
impl Waiters for Client
Source§fn wait_until_certificate_validated(&self) -> CertificateValidatedFluentBuilder
fn wait_until_certificate_validated(&self) -> CertificateValidatedFluentBuilder
certificate_validated
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);