pub struct Client { /* private fields */ }
Expand description
Client for AWS Support
Client for invoking operations on AWS Support. Each operation on AWS Support 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_support::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_support::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 AddAttachmentsToSet
operation has
a Client::add_attachments_to_set
, 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_attachments_to_set()
.attachment_set_id("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 add_attachments_to_set(&self) -> AddAttachmentsToSetFluentBuilder
pub fn add_attachments_to_set(&self) -> AddAttachmentsToSetFluentBuilder
Constructs a fluent builder for the AddAttachmentsToSet
operation.
- The fluent builder is configurable:
attachment_set_id(impl Into<String>)
/set_attachment_set_id(Option<String>)
:
required: falseThe ID of the attachment set. If an
attachmentSetId
is not specified, a new attachment set is created, and the ID of the set is returned in the response. If anattachmentSetId
is specified, the attachments are added to the specified set, if it exists.attachments(Attachment)
/set_attachments(Option<Vec::<Attachment>>)
:
required: trueOne or more attachments to add to the set. You can add up to three attachments per set. The size limit is 5 MB per attachment.
In the
Attachment
object, use thedata
parameter to specify the contents of the attachment file. In the previous request syntax, the value fordata
appear asblob
, which is represented as a base64-encoded string. The value forfileName
is the name of the attachment, such astroubleshoot-screenshot.png
.
- On success, responds with
AddAttachmentsToSetOutput
with field(s):attachment_set_id(Option<String>)
:The ID of the attachment set. If an
attachmentSetId
was not specified, a new attachment set is created, and the ID of the set is returned in the response. If anattachmentSetId
was specified, the attachments are added to the specified set, if it exists.expiry_time(Option<String>)
:The time and date when the attachment set expires.
- On failure, responds with
SdkError<AddAttachmentsToSetError>
Source§impl Client
impl Client
Sourcepub fn add_communication_to_case(&self) -> AddCommunicationToCaseFluentBuilder
pub fn add_communication_to_case(&self) -> AddCommunicationToCaseFluentBuilder
Constructs a fluent builder for the AddCommunicationToCase
operation.
- The fluent builder is configurable:
case_id(impl Into<String>)
/set_case_id(Option<String>)
:
required: falseThe support case ID requested or returned in the call. The case ID is an alphanumeric string formatted as shown in this example: case-12345678910-2013-c4c1d2bf33c5cf47
communication_body(impl Into<String>)
/set_communication_body(Option<String>)
:
required: trueThe body of an email communication to add to the support case.
cc_email_addresses(impl Into<String>)
/set_cc_email_addresses(Option<Vec::<String>>)
:
required: falseThe email addresses in the CC line of an email to be added to the support case.
attachment_set_id(impl Into<String>)
/set_attachment_set_id(Option<String>)
:
required: falseThe ID of a set of one or more attachments for the communication to add to the case. Create the set by calling
AddAttachmentsToSet
- On success, responds with
AddCommunicationToCaseOutput
with field(s):result(bool)
:True if
AddCommunicationToCase
succeeds. Otherwise, returns an error.
- On failure, responds with
SdkError<AddCommunicationToCaseError>
Source§impl Client
impl Client
Sourcepub fn create_case(&self) -> CreateCaseFluentBuilder
pub fn create_case(&self) -> CreateCaseFluentBuilder
Constructs a fluent builder for the CreateCase
operation.
- The fluent builder is configurable:
subject(impl Into<String>)
/set_subject(Option<String>)
:
required: trueThe title of the support case. The title appears in the Subject field on the Amazon Web Services Support Center Create Case page.
service_code(impl Into<String>)
/set_service_code(Option<String>)
:
required: falseThe code for the Amazon Web Services service. You can use the
DescribeServices
operation to get the possibleserviceCode
values.severity_code(impl Into<String>)
/set_severity_code(Option<String>)
:
required: falseA value that indicates the urgency of the case. This value determines the response time according to your service level agreement with Amazon Web Services Support. You can use the
DescribeSeverityLevels
operation to get the possible values forseverityCode
.For more information, see
SeverityLevel
and Choosing a Severity in the Amazon Web Services Support User Guide.The availability of severity levels depends on the support plan for the Amazon Web Services account.
category_code(impl Into<String>)
/set_category_code(Option<String>)
:
required: falseThe category of problem for the support case. You also use the
DescribeServices
operation to get the category code for a service. Each Amazon Web Services service defines its own set of category codes.communication_body(impl Into<String>)
/set_communication_body(Option<String>)
:
required: trueThe communication body text that describes the issue. This text appears in the Description field on the Amazon Web Services Support Center Create Case page.
cc_email_addresses(impl Into<String>)
/set_cc_email_addresses(Option<Vec::<String>>)
:
required: falseA list of email addresses that Amazon Web Services Support copies on case correspondence. Amazon Web Services Support identifies the account that creates the case when you specify your Amazon Web Services credentials in an HTTP POST method or use the Amazon Web Services SDKs.
language(impl Into<String>)
/set_language(Option<String>)
:
required: falseThe language in which Amazon Web Services Support handles the case. Amazon Web Services Support currently supports Chinese (“zh”), English (“en”), Japanese (“ja”) and Korean (“ko”). You must specify the ISO 639-1 code for the
language
parameter if you want support in that language.issue_type(impl Into<String>)
/set_issue_type(Option<String>)
:
required: falseThe type of issue for the case. You can specify
customer-service
ortechnical
. If you don’t specify a value, the default istechnical
.attachment_set_id(impl Into<String>)
/set_attachment_set_id(Option<String>)
:
required: falseThe ID of a set of one or more attachments for the case. Create the set by using the
AddAttachmentsToSet
operation.
- On success, responds with
CreateCaseOutput
with field(s):case_id(Option<String>)
:The support case ID requested or returned in the call. The case ID is an alphanumeric string in the following format: case-12345678910-2013-c4c1d2bf33c5cf47
- On failure, responds with
SdkError<CreateCaseError>
Source§impl Client
impl Client
Sourcepub fn describe_attachment(&self) -> DescribeAttachmentFluentBuilder
pub fn describe_attachment(&self) -> DescribeAttachmentFluentBuilder
Constructs a fluent builder for the DescribeAttachment
operation.
- The fluent builder is configurable:
attachment_id(impl Into<String>)
/set_attachment_id(Option<String>)
:
required: trueThe ID of the attachment to return. Attachment IDs are returned by the
DescribeCommunications
operation.
- On success, responds with
DescribeAttachmentOutput
with field(s):attachment(Option<Attachment>)
:This object includes the attachment content and file name.
In the previous response syntax, the value for the
data
parameter appears asblob
, which is represented as a base64-encoded string. The value forfileName
is the name of the attachment, such astroubleshoot-screenshot.png
.
- On failure, responds with
SdkError<DescribeAttachmentError>
Source§impl Client
impl Client
Sourcepub fn describe_cases(&self) -> DescribeCasesFluentBuilder
pub fn describe_cases(&self) -> DescribeCasesFluentBuilder
Constructs a fluent builder for the DescribeCases
operation.
This operation supports pagination; See into_paginator()
.
- The fluent builder is configurable:
case_id_list(impl Into<String>)
/set_case_id_list(Option<Vec::<String>>)
:
required: falseA list of ID numbers of the support cases you want returned. The maximum number of cases is 100.
display_id(impl Into<String>)
/set_display_id(Option<String>)
:
required: falseThe ID displayed for a case in the Amazon Web Services Support Center user interface.
after_time(impl Into<String>)
/set_after_time(Option<String>)
:
required: falseThe start date for a filtered date search on support case communications. Case communications are available for 12 months after creation.
before_time(impl Into<String>)
/set_before_time(Option<String>)
:
required: falseThe end date for a filtered date search on support case communications. Case communications are available for 12 months after creation.
include_resolved_cases(bool)
/set_include_resolved_cases(Option<bool>)
:
required: falseSpecifies whether to include resolved support cases in the
DescribeCases
response. By default, resolved cases aren’t included.next_token(impl Into<String>)
/set_next_token(Option<String>)
:
required: falseA resumption point for pagination.
max_results(i32)
/set_max_results(Option<i32>)
:
required: falseThe maximum number of results to return before paginating.
language(impl Into<String>)
/set_language(Option<String>)
:
required: falseThe language in which Amazon Web Services Support handles the case. Amazon Web Services Support currently supports Chinese (“zh”), English (“en”), Japanese (“ja”) and Korean (“ko”). You must specify the ISO 639-1 code for the
language
parameter if you want support in that language.include_communications(bool)
/set_include_communications(Option<bool>)
:
required: falseSpecifies whether to include communications in the
DescribeCases
response. By default, communications are included.
- On success, responds with
DescribeCasesOutput
with field(s):cases(Option<Vec::<CaseDetails>>)
:The details for the cases that match the request.
next_token(Option<String>)
:A resumption point for pagination.
- On failure, responds with
SdkError<DescribeCasesError>
Source§impl Client
impl Client
Sourcepub fn describe_communications(&self) -> DescribeCommunicationsFluentBuilder
pub fn describe_communications(&self) -> DescribeCommunicationsFluentBuilder
Constructs a fluent builder for the DescribeCommunications
operation.
This operation supports pagination; See into_paginator()
.
- The fluent builder is configurable:
case_id(impl Into<String>)
/set_case_id(Option<String>)
:
required: trueThe support case ID requested or returned in the call. The case ID is an alphanumeric string formatted as shown in this example: case-12345678910-2013-c4c1d2bf33c5cf47
before_time(impl Into<String>)
/set_before_time(Option<String>)
:
required: falseThe end date for a filtered date search on support case communications. Case communications are available for 12 months after creation.
after_time(impl Into<String>)
/set_after_time(Option<String>)
:
required: falseThe start date for a filtered date search on support case communications. Case communications are available for 12 months after creation.
next_token(impl Into<String>)
/set_next_token(Option<String>)
:
required: falseA resumption point for pagination.
max_results(i32)
/set_max_results(Option<i32>)
:
required: falseThe maximum number of results to return before paginating.
- On success, responds with
DescribeCommunicationsOutput
with field(s):communications(Option<Vec::<Communication>>)
:The communications for the case.
next_token(Option<String>)
:A resumption point for pagination.
- On failure, responds with
SdkError<DescribeCommunicationsError>
Source§impl Client
impl Client
Sourcepub fn describe_create_case_options(
&self,
) -> DescribeCreateCaseOptionsFluentBuilder
pub fn describe_create_case_options( &self, ) -> DescribeCreateCaseOptionsFluentBuilder
Constructs a fluent builder for the DescribeCreateCaseOptions
operation.
- The fluent builder is configurable:
issue_type(impl Into<String>)
/set_issue_type(Option<String>)
:
required: trueThe type of issue for the case. You can specify
customer-service
ortechnical
. If you don’t specify a value, the default istechnical
.service_code(impl Into<String>)
/set_service_code(Option<String>)
:
required: trueThe code for the Amazon Web Services service. You can use the
DescribeServices
operation to get the possibleserviceCode
values.language(impl Into<String>)
/set_language(Option<String>)
:
required: trueThe language in which Amazon Web Services Support handles the case. Amazon Web Services Support currently supports Chinese (“zh”), English (“en”), Japanese (“ja”) and Korean (“ko”). You must specify the ISO 639-1 code for the
language
parameter if you want support in that language.category_code(impl Into<String>)
/set_category_code(Option<String>)
:
required: trueThe category of problem for the support case. You also use the
DescribeServices
operation to get the category code for a service. Each Amazon Web Services service defines its own set of category codes.
- On success, responds with
DescribeCreateCaseOptionsOutput
with field(s):language_availability(Option<String>)
:Language availability can be any of the following:
-
available
-
best_effort
-
unavailable
-
communication_types(Option<Vec::<CommunicationTypeOptions>>)
:A JSON-formatted array that contains the available communication type options, along with the available support timeframes for the given inputs.
- On failure, responds with
SdkError<DescribeCreateCaseOptionsError>
Source§impl Client
impl Client
Sourcepub fn describe_services(&self) -> DescribeServicesFluentBuilder
pub fn describe_services(&self) -> DescribeServicesFluentBuilder
Constructs a fluent builder for the DescribeServices
operation.
- The fluent builder is configurable:
service_code_list(impl Into<String>)
/set_service_code_list(Option<Vec::<String>>)
:
required: falseA JSON-formatted list of service codes available for Amazon Web Services services.
language(impl Into<String>)
/set_language(Option<String>)
:
required: falseThe language in which Amazon Web Services Support handles the case. Amazon Web Services Support currently supports Chinese (“zh”), English (“en”), Japanese (“ja”) and Korean (“ko”). You must specify the ISO 639-1 code for the
language
parameter if you want support in that language.
- On success, responds with
DescribeServicesOutput
with field(s):services(Option<Vec::<Service>>)
:A JSON-formatted list of Amazon Web Services services.
- On failure, responds with
SdkError<DescribeServicesError>
Source§impl Client
impl Client
Sourcepub fn describe_severity_levels(&self) -> DescribeSeverityLevelsFluentBuilder
pub fn describe_severity_levels(&self) -> DescribeSeverityLevelsFluentBuilder
Constructs a fluent builder for the DescribeSeverityLevels
operation.
- The fluent builder is configurable:
language(impl Into<String>)
/set_language(Option<String>)
:
required: falseThe language in which Amazon Web Services Support handles the case. Amazon Web Services Support currently supports Chinese (“zh”), English (“en”), Japanese (“ja”) and Korean (“ko”). You must specify the ISO 639-1 code for the
language
parameter if you want support in that language.
- On success, responds with
DescribeSeverityLevelsOutput
with field(s):severity_levels(Option<Vec::<SeverityLevel>>)
:The available severity levels for the support case. Available severity levels are defined by your service level agreement with Amazon Web Services.
- On failure, responds with
SdkError<DescribeSeverityLevelsError>
Source§impl Client
impl Client
Sourcepub fn describe_supported_languages(
&self,
) -> DescribeSupportedLanguagesFluentBuilder
pub fn describe_supported_languages( &self, ) -> DescribeSupportedLanguagesFluentBuilder
Constructs a fluent builder for the DescribeSupportedLanguages
operation.
- The fluent builder is configurable:
issue_type(impl Into<String>)
/set_issue_type(Option<String>)
:
required: trueThe type of issue for the case. You can specify
customer-service
ortechnical
.service_code(impl Into<String>)
/set_service_code(Option<String>)
:
required: trueThe code for the Amazon Web Services service. You can use the
DescribeServices
operation to get the possibleserviceCode
values.category_code(impl Into<String>)
/set_category_code(Option<String>)
:
required: trueThe category of problem for the support case. You also use the
DescribeServices
operation to get the category code for a service. Each Amazon Web Services service defines its own set of category codes.
- On success, responds with
DescribeSupportedLanguagesOutput
with field(s):supported_languages(Option<Vec::<SupportedLanguage>>)
:A JSON-formatted array that contains the available ISO 639-1 language codes.
- On failure, responds with
SdkError<DescribeSupportedLanguagesError>
Source§impl Client
impl Client
Sourcepub fn describe_trusted_advisor_check_refresh_statuses(
&self,
) -> DescribeTrustedAdvisorCheckRefreshStatusesFluentBuilder
pub fn describe_trusted_advisor_check_refresh_statuses( &self, ) -> DescribeTrustedAdvisorCheckRefreshStatusesFluentBuilder
Constructs a fluent builder for the DescribeTrustedAdvisorCheckRefreshStatuses
operation.
- The fluent builder is configurable:
check_ids(Option<String>)
/set_check_ids(Option<Vec::<Option<String>>>)
:
required: trueThe IDs of the Trusted Advisor checks to get the status.
If you specify the check ID of a check that is automatically refreshed, you might see an
InvalidParameterValue
error.
- On success, responds with
DescribeTrustedAdvisorCheckRefreshStatusesOutput
with field(s):statuses(Vec::<TrustedAdvisorCheckRefreshStatus>)
:The refresh status of the specified Trusted Advisor checks.
- On failure, responds with
SdkError<DescribeTrustedAdvisorCheckRefreshStatusesError>
Source§impl Client
impl Client
Sourcepub fn describe_trusted_advisor_check_result(
&self,
) -> DescribeTrustedAdvisorCheckResultFluentBuilder
pub fn describe_trusted_advisor_check_result( &self, ) -> DescribeTrustedAdvisorCheckResultFluentBuilder
Constructs a fluent builder for the DescribeTrustedAdvisorCheckResult
operation.
- The fluent builder is configurable:
check_id(impl Into<String>)
/set_check_id(Option<String>)
:
required: trueThe unique identifier for the Trusted Advisor check.
language(impl Into<String>)
/set_language(Option<String>)
:
required: falseThe ISO 639-1 code for the language that you want your check results to appear in.
The Amazon Web Services Support API currently supports the following languages for Trusted Advisor:
-
Chinese, Simplified -
zh
-
Chinese, Traditional -
zh_TW
-
English -
en
-
French -
fr
-
German -
de
-
Indonesian -
id
-
Italian -
it
-
Japanese -
ja
-
Korean -
ko
-
Portuguese, Brazilian -
pt_BR
-
Spanish -
es
-
- On success, responds with
DescribeTrustedAdvisorCheckResultOutput
with field(s):result(Option<TrustedAdvisorCheckResult>)
:The detailed results of the Trusted Advisor check.
- On failure, responds with
SdkError<DescribeTrustedAdvisorCheckResultError>
Source§impl Client
impl Client
Sourcepub fn describe_trusted_advisor_check_summaries(
&self,
) -> DescribeTrustedAdvisorCheckSummariesFluentBuilder
pub fn describe_trusted_advisor_check_summaries( &self, ) -> DescribeTrustedAdvisorCheckSummariesFluentBuilder
Constructs a fluent builder for the DescribeTrustedAdvisorCheckSummaries
operation.
- The fluent builder is configurable:
check_ids(Option<String>)
/set_check_ids(Option<Vec::<Option<String>>>)
:
required: trueThe IDs of the Trusted Advisor checks.
- On success, responds with
DescribeTrustedAdvisorCheckSummariesOutput
with field(s):summaries(Vec::<TrustedAdvisorCheckSummary>)
:The summary information for the requested Trusted Advisor checks.
- On failure, responds with
SdkError<DescribeTrustedAdvisorCheckSummariesError>
Source§impl Client
impl Client
Sourcepub fn describe_trusted_advisor_checks(
&self,
) -> DescribeTrustedAdvisorChecksFluentBuilder
pub fn describe_trusted_advisor_checks( &self, ) -> DescribeTrustedAdvisorChecksFluentBuilder
Constructs a fluent builder for the DescribeTrustedAdvisorChecks
operation.
- The fluent builder is configurable:
language(impl Into<String>)
/set_language(Option<String>)
:
required: trueThe ISO 639-1 code for the language that you want your checks to appear in.
The Amazon Web Services Support API currently supports the following languages for Trusted Advisor:
-
Chinese, Simplified -
zh
-
Chinese, Traditional -
zh_TW
-
English -
en
-
French -
fr
-
German -
de
-
Indonesian -
id
-
Italian -
it
-
Japanese -
ja
-
Korean -
ko
-
Portuguese, Brazilian -
pt_BR
-
Spanish -
es
-
- On success, responds with
DescribeTrustedAdvisorChecksOutput
with field(s):checks(Vec::<TrustedAdvisorCheckDescription>)
:Information about all available Trusted Advisor checks.
- On failure, responds with
SdkError<DescribeTrustedAdvisorChecksError>
Source§impl Client
impl Client
Sourcepub fn refresh_trusted_advisor_check(
&self,
) -> RefreshTrustedAdvisorCheckFluentBuilder
pub fn refresh_trusted_advisor_check( &self, ) -> RefreshTrustedAdvisorCheckFluentBuilder
Constructs a fluent builder for the RefreshTrustedAdvisorCheck
operation.
- The fluent builder is configurable:
check_id(impl Into<String>)
/set_check_id(Option<String>)
:
required: trueThe unique identifier for the Trusted Advisor check to refresh.
Specifying the check ID of a check that is automatically refreshed causes an
InvalidParameterValue
error.
- On success, responds with
RefreshTrustedAdvisorCheckOutput
with field(s):status(Option<TrustedAdvisorCheckRefreshStatus>)
:The current refresh status for a check, including the amount of time until the check is eligible for refresh.
- On failure, responds with
SdkError<RefreshTrustedAdvisorCheckError>
Source§impl Client
impl Client
Sourcepub fn resolve_case(&self) -> ResolveCaseFluentBuilder
pub fn resolve_case(&self) -> ResolveCaseFluentBuilder
Constructs a fluent builder for the ResolveCase
operation.
- The fluent builder is configurable:
case_id(impl Into<String>)
/set_case_id(Option<String>)
:
required: falseThe support case ID requested or returned in the call. The case ID is an alphanumeric string formatted as shown in this example: case-12345678910-2013-c4c1d2bf33c5cf47
- On success, responds with
ResolveCaseOutput
with field(s):initial_case_status(Option<String>)
:The status of the case when the
ResolveCase
request was sent.final_case_status(Option<String>)
:The status of the case after the
ResolveCase
request was processed.
- On failure, responds with
SdkError<ResolveCaseError>
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);