pub struct Client { /* private fields */ }Expand description
Client for Amazon Kinesis Firehose
Client for invoking operations on Amazon Kinesis Firehose. Each operation on Amazon Kinesis Firehose 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_firehose::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_firehose::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 CreateDeliveryStream operation has
a Client::create_delivery_stream, 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.create_delivery_stream()
.delivery_stream_name("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 create_delivery_stream(&self) -> CreateDeliveryStreamFluentBuilder
pub fn create_delivery_stream(&self) -> CreateDeliveryStreamFluentBuilder
Constructs a fluent builder for the CreateDeliveryStream operation.
- The fluent builder is configurable:
delivery_stream_name(impl Into<String>)/set_delivery_stream_name(Option<String>):
required: trueThe name of the Firehose stream. This name must be unique per Amazon Web Services account in the same Amazon Web Services Region. If the Firehose streams are in different accounts or different Regions, you can have multiple Firehose streams with the same name.
delivery_stream_type(DeliveryStreamType)/set_delivery_stream_type(Option<DeliveryStreamType>):
required: falseThe Firehose stream type. This parameter can be one of the following values:
-
DirectPut: Provider applications access the Firehose stream directly. -
KinesisStreamAsSource: The Firehose stream uses a Kinesis data stream as a source.
-
direct_put_source_configuration(DirectPutSourceConfiguration)/set_direct_put_source_configuration(Option<DirectPutSourceConfiguration>):
required: falseThe structure that configures parameters such as
ThroughputHintInMBsfor a stream configured with Direct PUT as a source.kinesis_stream_source_configuration(KinesisStreamSourceConfiguration)/set_kinesis_stream_source_configuration(Option<KinesisStreamSourceConfiguration>):
required: falseWhen a Kinesis data stream is used as the source for the Firehose stream, a
KinesisStreamSourceConfigurationcontaining the Kinesis data stream Amazon Resource Name (ARN) and the role ARN for the source stream.delivery_stream_encryption_configuration_input(DeliveryStreamEncryptionConfigurationInput)/set_delivery_stream_encryption_configuration_input(Option<DeliveryStreamEncryptionConfigurationInput>):
required: falseUsed to specify the type and Amazon Resource Name (ARN) of the KMS key needed for Server-Side Encryption (SSE).
s3_destination_configuration(S3DestinationConfiguration)/set_s3_destination_configuration(Option<S3DestinationConfiguration>):
required: false[Deprecated] The destination in Amazon S3. You can specify only one destination.
extended_s3_destination_configuration(ExtendedS3DestinationConfiguration)/set_extended_s3_destination_configuration(Option<ExtendedS3DestinationConfiguration>):
required: falseThe destination in Amazon S3. You can specify only one destination.
redshift_destination_configuration(RedshiftDestinationConfiguration)/set_redshift_destination_configuration(Option<RedshiftDestinationConfiguration>):
required: falseThe destination in Amazon Redshift. You can specify only one destination.
elasticsearch_destination_configuration(ElasticsearchDestinationConfiguration)/set_elasticsearch_destination_configuration(Option<ElasticsearchDestinationConfiguration>):
required: falseThe destination in Amazon OpenSearch Service. You can specify only one destination.
amazonopensearchservice_destination_configuration(AmazonopensearchserviceDestinationConfiguration)/set_amazonopensearchservice_destination_configuration(Option<AmazonopensearchserviceDestinationConfiguration>):
required: falseThe destination in Amazon OpenSearch Service. You can specify only one destination.
splunk_destination_configuration(SplunkDestinationConfiguration)/set_splunk_destination_configuration(Option<SplunkDestinationConfiguration>):
required: falseThe destination in Splunk. You can specify only one destination.
http_endpoint_destination_configuration(HttpEndpointDestinationConfiguration)/set_http_endpoint_destination_configuration(Option<HttpEndpointDestinationConfiguration>):
required: falseEnables configuring Kinesis Firehose to deliver data to any HTTP endpoint destination. You can specify only one destination.
tags(Tag)/set_tags(Option<Vec::<Tag>>):
required: falseA set of tags to assign to the Firehose stream. A tag is a key-value pair that you can define and assign to Amazon Web Services resources. Tags are metadata. For example, you can add friendly names and descriptions or other types of information that can help you distinguish the Firehose stream. For more information about tags, see Using Cost Allocation Tags in the Amazon Web Services Billing and Cost Management User Guide.
You can specify up to 50 tags when creating a Firehose stream.
If you specify tags in the
CreateDeliveryStreamaction, Amazon Data Firehose performs an additional authorization on thefirehose:TagDeliveryStreamaction to verify if users have permissions to create tags. If you do not provide this permission, requests to create new Firehose streams with IAM resource tags will fail with anAccessDeniedExceptionsuch as following.AccessDeniedException
User: arn:aws:sts::x:assumed-role/x/x is not authorized to perform: firehose:TagDeliveryStream on resource: arn:aws:firehose:us-east-1:x:deliverystream/x with an explicit deny in an identity-based policy.
For an example IAM policy, see Tag example.
amazon_open_search_serverless_destination_configuration(AmazonOpenSearchServerlessDestinationConfiguration)/set_amazon_open_search_serverless_destination_configuration(Option<AmazonOpenSearchServerlessDestinationConfiguration>):
required: falseThe destination in the Serverless offering for Amazon OpenSearch Service. You can specify only one destination.
msk_source_configuration(MskSourceConfiguration)/set_msk_source_configuration(Option<MskSourceConfiguration>):
required: falseThe configuration for the Amazon MSK cluster to be used as the source for a delivery stream.
snowflake_destination_configuration(SnowflakeDestinationConfiguration)/set_snowflake_destination_configuration(Option<SnowflakeDestinationConfiguration>):
required: falseConfigure Snowflake destination
iceberg_destination_configuration(IcebergDestinationConfiguration)/set_iceberg_destination_configuration(Option<IcebergDestinationConfiguration>):
required: falseConfigure Apache Iceberg Tables destination.
database_source_configuration(DatabaseSourceConfiguration)/set_database_source_configuration(Option<DatabaseSourceConfiguration>):
required: falseThe top level object for configuring streams with database as a source.
Amazon Data Firehose is in preview release and is subject to change.
- On success, responds with
CreateDeliveryStreamOutputwith field(s):delivery_stream_arn(Option<String>):The ARN of the Firehose stream.
- On failure, responds with
SdkError<CreateDeliveryStreamError>
Source§impl Client
impl Client
Sourcepub fn delete_delivery_stream(&self) -> DeleteDeliveryStreamFluentBuilder
pub fn delete_delivery_stream(&self) -> DeleteDeliveryStreamFluentBuilder
Constructs a fluent builder for the DeleteDeliveryStream operation.
- The fluent builder is configurable:
delivery_stream_name(impl Into<String>)/set_delivery_stream_name(Option<String>):
required: trueThe name of the Firehose stream.
allow_force_delete(bool)/set_allow_force_delete(Option<bool>):
required: falseSet this to true if you want to delete the Firehose stream even if Firehose is unable to retire the grant for the CMK. Firehose might be unable to retire the grant due to a customer error, such as when the CMK or the grant are in an invalid state. If you force deletion, you can then use the RevokeGrant operation to revoke the grant you gave to Firehose. If a failure to retire the grant happens due to an Amazon Web Services KMS issue, Firehose keeps retrying the delete operation.
The default value is false.
- On success, responds with
DeleteDeliveryStreamOutput - On failure, responds with
SdkError<DeleteDeliveryStreamError>
Source§impl Client
impl Client
Sourcepub fn describe_delivery_stream(&self) -> DescribeDeliveryStreamFluentBuilder
pub fn describe_delivery_stream(&self) -> DescribeDeliveryStreamFluentBuilder
Constructs a fluent builder for the DescribeDeliveryStream operation.
- The fluent builder is configurable:
delivery_stream_name(impl Into<String>)/set_delivery_stream_name(Option<String>):
required: trueThe name of the Firehose stream.
limit(i32)/set_limit(Option<i32>):
required: falseThe limit on the number of destinations to return. You can have one destination per Firehose stream.
exclusive_start_destination_id(impl Into<String>)/set_exclusive_start_destination_id(Option<String>):
required: falseThe ID of the destination to start returning the destination information. Firehose supports one destination per Firehose stream.
- On success, responds with
DescribeDeliveryStreamOutputwith field(s):delivery_stream_description(Option<DeliveryStreamDescription>):Information about the Firehose stream.
- On failure, responds with
SdkError<DescribeDeliveryStreamError>
Source§impl Client
impl Client
Sourcepub fn list_delivery_streams(&self) -> ListDeliveryStreamsFluentBuilder
pub fn list_delivery_streams(&self) -> ListDeliveryStreamsFluentBuilder
Constructs a fluent builder for the ListDeliveryStreams operation.
- The fluent builder is configurable:
limit(i32)/set_limit(Option<i32>):
required: falseThe maximum number of Firehose streams to list. The default value is 10.
delivery_stream_type(DeliveryStreamType)/set_delivery_stream_type(Option<DeliveryStreamType>):
required: falseThe Firehose stream type. This can be one of the following values:
-
DirectPut: Provider applications access the Firehose stream directly. -
KinesisStreamAsSource: The Firehose stream uses a Kinesis data stream as a source.
This parameter is optional. If this parameter is omitted, Firehose streams of all types are returned.
-
exclusive_start_delivery_stream_name(impl Into<String>)/set_exclusive_start_delivery_stream_name(Option<String>):
required: falseThe list of Firehose streams returned by this call to
ListDeliveryStreamswill start with the Firehose stream whose name comes alphabetically immediately after the name you specify inExclusiveStartDeliveryStreamName.
- On success, responds with
ListDeliveryStreamsOutputwith field(s):delivery_stream_names(Vec::<String>):The names of the Firehose streams.
has_more_delivery_streams(bool):Indicates whether there are more Firehose streams available to list.
- On failure, responds with
SdkError<ListDeliveryStreamsError>
Source§impl Client
impl Client
Constructs a fluent builder for the ListTagsForDeliveryStream operation.
- The fluent builder is configurable:
delivery_stream_name(impl Into<String>)/set_delivery_stream_name(Option<String>):
required: trueThe name of the Firehose stream whose tags you want to list.
exclusive_start_tag_key(impl Into<String>)/set_exclusive_start_tag_key(Option<String>):
required: falseThe key to use as the starting point for the list of tags. If you set this parameter,
ListTagsForDeliveryStreamgets all tags that occur afterExclusiveStartTagKey.limit(i32)/set_limit(Option<i32>):
required: falseThe number of tags to return. If this number is less than the total number of tags associated with the Firehose stream,
HasMoreTagsis set totruein the response. To list additional tags, setExclusiveStartTagKeyto the last key in the response.
- On success, responds with
ListTagsForDeliveryStreamOutputwith field(s):tags(Vec::<Tag>):A list of tags associated with
DeliveryStreamName, starting with the first tag afterExclusiveStartTagKeyand up to the specifiedLimit.has_more_tags(bool):If this is
truein the response, more tags are available. To list the remaining tags, setExclusiveStartTagKeyto the key of the last tag returned and callListTagsForDeliveryStreamagain.
- On failure, responds with
SdkError<ListTagsForDeliveryStreamError>
Source§impl Client
impl Client
Sourcepub fn put_record(&self) -> PutRecordFluentBuilder
pub fn put_record(&self) -> PutRecordFluentBuilder
Constructs a fluent builder for the PutRecord operation.
- The fluent builder is configurable:
delivery_stream_name(impl Into<String>)/set_delivery_stream_name(Option<String>):
required: trueThe name of the Firehose stream.
record(Record)/set_record(Option<Record>):
required: trueThe record.
- On success, responds with
PutRecordOutputwith field(s):record_id(String):The ID of the record.
encrypted(Option<bool>):Indicates whether server-side encryption (SSE) was enabled during this operation.
- On failure, responds with
SdkError<PutRecordError>
Source§impl Client
impl Client
Sourcepub fn put_record_batch(&self) -> PutRecordBatchFluentBuilder
pub fn put_record_batch(&self) -> PutRecordBatchFluentBuilder
Constructs a fluent builder for the PutRecordBatch operation.
- The fluent builder is configurable:
delivery_stream_name(impl Into<String>)/set_delivery_stream_name(Option<String>):
required: trueThe name of the Firehose stream.
records(Record)/set_records(Option<Vec::<Record>>):
required: trueOne or more records.
- On success, responds with
PutRecordBatchOutputwith field(s):failed_put_count(i32):The number of records that might have failed processing. This number might be greater than 0 even if the
PutRecordBatchcall succeeds. CheckFailedPutCountto determine whether there are records that you need to resend.encrypted(Option<bool>):Indicates whether server-side encryption (SSE) was enabled during this operation.
request_responses(Vec::<PutRecordBatchResponseEntry>):The results array. For each record, the index of the response element is the same as the index used in the request array.
- On failure, responds with
SdkError<PutRecordBatchError>
Source§impl Client
impl Client
Sourcepub fn start_delivery_stream_encryption(
&self,
) -> StartDeliveryStreamEncryptionFluentBuilder
pub fn start_delivery_stream_encryption( &self, ) -> StartDeliveryStreamEncryptionFluentBuilder
Constructs a fluent builder for the StartDeliveryStreamEncryption operation.
- The fluent builder is configurable:
delivery_stream_name(impl Into<String>)/set_delivery_stream_name(Option<String>):
required: trueThe name of the Firehose stream for which you want to enable server-side encryption (SSE).
delivery_stream_encryption_configuration_input(DeliveryStreamEncryptionConfigurationInput)/set_delivery_stream_encryption_configuration_input(Option<DeliveryStreamEncryptionConfigurationInput>):
required: falseUsed to specify the type and Amazon Resource Name (ARN) of the KMS key needed for Server-Side Encryption (SSE).
- On success, responds with
StartDeliveryStreamEncryptionOutput - On failure, responds with
SdkError<StartDeliveryStreamEncryptionError>
Source§impl Client
impl Client
Sourcepub fn stop_delivery_stream_encryption(
&self,
) -> StopDeliveryStreamEncryptionFluentBuilder
pub fn stop_delivery_stream_encryption( &self, ) -> StopDeliveryStreamEncryptionFluentBuilder
Constructs a fluent builder for the StopDeliveryStreamEncryption operation.
- The fluent builder is configurable:
delivery_stream_name(impl Into<String>)/set_delivery_stream_name(Option<String>):
required: trueThe name of the Firehose stream for which you want to disable server-side encryption (SSE).
- On success, responds with
StopDeliveryStreamEncryptionOutput - On failure, responds with
SdkError<StopDeliveryStreamEncryptionError>
Source§impl Client
impl Client
Sourcepub fn tag_delivery_stream(&self) -> TagDeliveryStreamFluentBuilder
pub fn tag_delivery_stream(&self) -> TagDeliveryStreamFluentBuilder
Constructs a fluent builder for the TagDeliveryStream operation.
- The fluent builder is configurable:
delivery_stream_name(impl Into<String>)/set_delivery_stream_name(Option<String>):
required: trueThe name of the Firehose stream to which you want to add the tags.
tags(Tag)/set_tags(Option<Vec::<Tag>>):
required: trueA set of key-value pairs to use to create the tags.
- On success, responds with
TagDeliveryStreamOutput - On failure, responds with
SdkError<TagDeliveryStreamError>
Source§impl Client
impl Client
Sourcepub fn untag_delivery_stream(&self) -> UntagDeliveryStreamFluentBuilder
pub fn untag_delivery_stream(&self) -> UntagDeliveryStreamFluentBuilder
Constructs a fluent builder for the UntagDeliveryStream operation.
- The fluent builder is configurable:
delivery_stream_name(impl Into<String>)/set_delivery_stream_name(Option<String>):
required: trueThe name of the Firehose stream.
tag_keys(impl Into<String>)/set_tag_keys(Option<Vec::<String>>):
required: trueA list of tag keys. Each corresponding tag is removed from the delivery stream.
- On success, responds with
UntagDeliveryStreamOutput - On failure, responds with
SdkError<UntagDeliveryStreamError>
Source§impl Client
impl Client
Sourcepub fn update_destination(&self) -> UpdateDestinationFluentBuilder
pub fn update_destination(&self) -> UpdateDestinationFluentBuilder
Constructs a fluent builder for the UpdateDestination operation.
- The fluent builder is configurable:
delivery_stream_name(impl Into<String>)/set_delivery_stream_name(Option<String>):
required: trueThe name of the Firehose stream.
current_delivery_stream_version_id(impl Into<String>)/set_current_delivery_stream_version_id(Option<String>):
required: trueObtain this value from the
VersionIdresult ofDeliveryStreamDescription. This value is required, and helps the service perform conditional operations. For example, if there is an interleaving update and this value is null, then the update destination fails. After the update is successful, theVersionIdvalue is updated. The service then performs a merge of the old configuration with the new configuration.destination_id(impl Into<String>)/set_destination_id(Option<String>):
required: trueThe ID of the destination.
s3_destination_update(S3DestinationUpdate)/set_s3_destination_update(Option<S3DestinationUpdate>):
required: false[Deprecated] Describes an update for a destination in Amazon S3.
extended_s3_destination_update(ExtendedS3DestinationUpdate)/set_extended_s3_destination_update(Option<ExtendedS3DestinationUpdate>):
required: falseDescribes an update for a destination in Amazon S3.
redshift_destination_update(RedshiftDestinationUpdate)/set_redshift_destination_update(Option<RedshiftDestinationUpdate>):
required: falseDescribes an update for a destination in Amazon Redshift.
elasticsearch_destination_update(ElasticsearchDestinationUpdate)/set_elasticsearch_destination_update(Option<ElasticsearchDestinationUpdate>):
required: falseDescribes an update for a destination in Amazon OpenSearch Service.
amazonopensearchservice_destination_update(AmazonopensearchserviceDestinationUpdate)/set_amazonopensearchservice_destination_update(Option<AmazonopensearchserviceDestinationUpdate>):
required: falseDescribes an update for a destination in Amazon OpenSearch Service.
splunk_destination_update(SplunkDestinationUpdate)/set_splunk_destination_update(Option<SplunkDestinationUpdate>):
required: falseDescribes an update for a destination in Splunk.
http_endpoint_destination_update(HttpEndpointDestinationUpdate)/set_http_endpoint_destination_update(Option<HttpEndpointDestinationUpdate>):
required: falseDescribes an update to the specified HTTP endpoint destination.
amazon_open_search_serverless_destination_update(AmazonOpenSearchServerlessDestinationUpdate)/set_amazon_open_search_serverless_destination_update(Option<AmazonOpenSearchServerlessDestinationUpdate>):
required: falseDescribes an update for a destination in the Serverless offering for Amazon OpenSearch Service.
snowflake_destination_update(SnowflakeDestinationUpdate)/set_snowflake_destination_update(Option<SnowflakeDestinationUpdate>):
required: falseUpdate to the Snowflake destination configuration settings.
iceberg_destination_update(IcebergDestinationUpdate)/set_iceberg_destination_update(Option<IcebergDestinationUpdate>):
required: falseDescribes an update for a destination in Apache Iceberg Tables.
- On success, responds with
UpdateDestinationOutput - On failure, responds with
SdkError<UpdateDestinationError>
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_implconfigured. - Identity caching is enabled without a
sleep_implandtime_sourceconfigured. - No
behavior_versionis 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_configis missing an async sleep implementation. If you experience this panic, set thesleep_implon the Config passed into this function to fix it. - This method will panic if the
sdk_configis missing an HTTP connector. If you experience this panic, set thehttp_connectoron the Config passed into this function to fix it. - This method will panic if no
BehaviorVersionis provided. If you experience this panic, setbehavior_versionon the Config or enable thebehavior-version-latestCargo 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);