pub struct Client { /* private fields */ }
Expand description
Client for Amazon S3 Vectors
Client for invoking operations on Amazon S3 Vectors. Each operation on Amazon S3 Vectors 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_s3vectors::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_s3vectors::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 CreateIndex
operation has
a Client::create_index
, 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_index()
.vector_bucket_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_index(&self) -> CreateIndexFluentBuilder
pub fn create_index(&self) -> CreateIndexFluentBuilder
Constructs a fluent builder for the CreateIndex
operation.
- The fluent builder is configurable:
vector_bucket_name(impl Into<String>)
/set_vector_bucket_name(Option<String>)
:
required: falseThe name of the vector bucket to create the vector index in.
vector_bucket_arn(impl Into<String>)
/set_vector_bucket_arn(Option<String>)
:
required: falseThe Amazon Resource Name (ARN) of the vector bucket to create the vector index in.
index_name(impl Into<String>)
/set_index_name(Option<String>)
:
required: trueThe name of the vector index to create.
data_type(DataType)
/set_data_type(Option<DataType>)
:
required: trueThe data type of the vectors to be inserted into the vector index.
dimension(i32)
/set_dimension(Option<i32>)
:
required: trueThe dimensions of the vectors to be inserted into the vector index.
distance_metric(DistanceMetric)
/set_distance_metric(Option<DistanceMetric>)
:
required: trueThe distance metric to be used for similarity search.
metadata_configuration(MetadataConfiguration)
/set_metadata_configuration(Option<MetadataConfiguration>)
:
required: falseThe metadata configuration for the vector index.
- On success, responds with
CreateIndexOutput
- On failure, responds with
SdkError<CreateIndexError>
Source§impl Client
impl Client
Sourcepub fn create_vector_bucket(&self) -> CreateVectorBucketFluentBuilder
pub fn create_vector_bucket(&self) -> CreateVectorBucketFluentBuilder
Constructs a fluent builder for the CreateVectorBucket
operation.
- The fluent builder is configurable:
vector_bucket_name(impl Into<String>)
/set_vector_bucket_name(Option<String>)
:
required: trueThe name of the vector bucket to create.
encryption_configuration(EncryptionConfiguration)
/set_encryption_configuration(Option<EncryptionConfiguration>)
:
required: falseThe encryption configuration for the vector bucket. By default, if you don’t specify, all new vectors in Amazon S3 vector buckets use server-side encryption with Amazon S3 managed keys (SSE-S3), specifically
AES256
.
- On success, responds with
CreateVectorBucketOutput
- On failure, responds with
SdkError<CreateVectorBucketError>
Source§impl Client
impl Client
Sourcepub fn delete_index(&self) -> DeleteIndexFluentBuilder
pub fn delete_index(&self) -> DeleteIndexFluentBuilder
Constructs a fluent builder for the DeleteIndex
operation.
- The fluent builder is configurable:
vector_bucket_name(impl Into<String>)
/set_vector_bucket_name(Option<String>)
:
required: falseThe name of the vector bucket that contains the vector index.
index_name(impl Into<String>)
/set_index_name(Option<String>)
:
required: falseThe name of the vector index to delete.
index_arn(impl Into<String>)
/set_index_arn(Option<String>)
:
required: falseThe ARN of the vector index to delete.
- On success, responds with
DeleteIndexOutput
- On failure, responds with
SdkError<DeleteIndexError>
Source§impl Client
impl Client
Sourcepub fn delete_vector_bucket(&self) -> DeleteVectorBucketFluentBuilder
pub fn delete_vector_bucket(&self) -> DeleteVectorBucketFluentBuilder
Constructs a fluent builder for the DeleteVectorBucket
operation.
- The fluent builder is configurable:
vector_bucket_name(impl Into<String>)
/set_vector_bucket_name(Option<String>)
:
required: falseThe name of the vector bucket to delete.
vector_bucket_arn(impl Into<String>)
/set_vector_bucket_arn(Option<String>)
:
required: falseThe ARN of the vector bucket to delete.
- On success, responds with
DeleteVectorBucketOutput
- On failure, responds with
SdkError<DeleteVectorBucketError>
Source§impl Client
impl Client
Sourcepub fn delete_vector_bucket_policy(
&self,
) -> DeleteVectorBucketPolicyFluentBuilder
pub fn delete_vector_bucket_policy( &self, ) -> DeleteVectorBucketPolicyFluentBuilder
Constructs a fluent builder for the DeleteVectorBucketPolicy
operation.
- The fluent builder is configurable:
vector_bucket_name(impl Into<String>)
/set_vector_bucket_name(Option<String>)
:
required: falseThe name of the vector bucket to delete the policy from.
vector_bucket_arn(impl Into<String>)
/set_vector_bucket_arn(Option<String>)
:
required: falseThe ARN of the vector bucket to delete the policy from.
- On success, responds with
DeleteVectorBucketPolicyOutput
- On failure, responds with
SdkError<DeleteVectorBucketPolicyError>
Source§impl Client
impl Client
Sourcepub fn delete_vectors(&self) -> DeleteVectorsFluentBuilder
pub fn delete_vectors(&self) -> DeleteVectorsFluentBuilder
Constructs a fluent builder for the DeleteVectors
operation.
- The fluent builder is configurable:
vector_bucket_name(impl Into<String>)
/set_vector_bucket_name(Option<String>)
:
required: falseThe name of the vector bucket that contains the vector index.
index_name(impl Into<String>)
/set_index_name(Option<String>)
:
required: falseThe name of the vector index that contains a vector you want to delete.
index_arn(impl Into<String>)
/set_index_arn(Option<String>)
:
required: falseThe ARN of the vector index that contains a vector you want to delete.
keys(impl Into<String>)
/set_keys(Option<Vec::<String>>)
:
required: trueThe keys of the vectors to delete.
- On success, responds with
DeleteVectorsOutput
- On failure, responds with
SdkError<DeleteVectorsError>
Source§impl Client
impl Client
Sourcepub fn get_index(&self) -> GetIndexFluentBuilder
pub fn get_index(&self) -> GetIndexFluentBuilder
Constructs a fluent builder for the GetIndex
operation.
- The fluent builder is configurable:
vector_bucket_name(impl Into<String>)
/set_vector_bucket_name(Option<String>)
:
required: falseThe name of the vector bucket that contains the vector index.
index_name(impl Into<String>)
/set_index_name(Option<String>)
:
required: falseThe name of the vector index.
index_arn(impl Into<String>)
/set_index_arn(Option<String>)
:
required: falseThe ARN of the vector index.
- On success, responds with
GetIndexOutput
with field(s):index(Option<Index>)
:The attributes of the vector index.
- On failure, responds with
SdkError<GetIndexError>
Source§impl Client
impl Client
Sourcepub fn get_vector_bucket(&self) -> GetVectorBucketFluentBuilder
pub fn get_vector_bucket(&self) -> GetVectorBucketFluentBuilder
Constructs a fluent builder for the GetVectorBucket
operation.
- The fluent builder is configurable:
vector_bucket_name(impl Into<String>)
/set_vector_bucket_name(Option<String>)
:
required: falseThe name of the vector bucket to retrieve information about.
vector_bucket_arn(impl Into<String>)
/set_vector_bucket_arn(Option<String>)
:
required: falseThe ARN of the vector bucket to retrieve information about.
- On success, responds with
GetVectorBucketOutput
with field(s):vector_bucket(Option<VectorBucket>)
:The attributes of the vector bucket.
- On failure, responds with
SdkError<GetVectorBucketError>
Source§impl Client
impl Client
Sourcepub fn get_vector_bucket_policy(&self) -> GetVectorBucketPolicyFluentBuilder
pub fn get_vector_bucket_policy(&self) -> GetVectorBucketPolicyFluentBuilder
Constructs a fluent builder for the GetVectorBucketPolicy
operation.
- The fluent builder is configurable:
vector_bucket_name(impl Into<String>)
/set_vector_bucket_name(Option<String>)
:
required: falseThe name of the vector bucket.
vector_bucket_arn(impl Into<String>)
/set_vector_bucket_arn(Option<String>)
:
required: falseThe ARN of the vector bucket.
- On success, responds with
GetVectorBucketPolicyOutput
with field(s):policy(Option<String>)
:The
JSON
that defines the policy.
- On failure, responds with
SdkError<GetVectorBucketPolicyError>
Source§impl Client
impl Client
Sourcepub fn get_vectors(&self) -> GetVectorsFluentBuilder
pub fn get_vectors(&self) -> GetVectorsFluentBuilder
Constructs a fluent builder for the GetVectors
operation.
- The fluent builder is configurable:
vector_bucket_name(impl Into<String>)
/set_vector_bucket_name(Option<String>)
:
required: falseThe name of the vector bucket that contains the vector index.
index_name(impl Into<String>)
/set_index_name(Option<String>)
:
required: falseThe name of the vector index.
index_arn(impl Into<String>)
/set_index_arn(Option<String>)
:
required: falseThe ARN of the vector index.
keys(impl Into<String>)
/set_keys(Option<Vec::<String>>)
:
required: trueThe names of the vectors you want to return attributes for.
return_data(bool)
/set_return_data(Option<bool>)
:
required: falseIndicates whether to include the vector data in the response. The default value is
false
.return_metadata(bool)
/set_return_metadata(Option<bool>)
:
required: falseIndicates whether to include metadata in the response. The default value is
false
.
- On success, responds with
GetVectorsOutput
with field(s):vectors(Vec::<GetOutputVector>)
:The attributes of the vectors.
- On failure, responds with
SdkError<GetVectorsError>
Source§impl Client
impl Client
Sourcepub fn list_indexes(&self) -> ListIndexesFluentBuilder
pub fn list_indexes(&self) -> ListIndexesFluentBuilder
Constructs a fluent builder for the ListIndexes
operation.
This operation supports pagination; See into_paginator()
.
- The fluent builder is configurable:
vector_bucket_name(impl Into<String>)
/set_vector_bucket_name(Option<String>)
:
required: falseThe name of the vector bucket that contains the vector indexes.
vector_bucket_arn(impl Into<String>)
/set_vector_bucket_arn(Option<String>)
:
required: falseThe ARN of the vector bucket that contains the vector indexes.
max_results(i32)
/set_max_results(Option<i32>)
:
required: falseThe maximum number of items to be returned in the response.
next_token(impl Into<String>)
/set_next_token(Option<String>)
:
required: falseThe previous pagination token.
prefix(impl Into<String>)
/set_prefix(Option<String>)
:
required: falseLimits the response to vector indexes that begin with the specified prefix.
- On success, responds with
ListIndexesOutput
with field(s):next_token(Option<String>)
:The next pagination token.
indexes(Vec::<IndexSummary>)
:The attributes of the vector indexes
- On failure, responds with
SdkError<ListIndexesError>
Source§impl Client
impl Client
Sourcepub fn list_vector_buckets(&self) -> ListVectorBucketsFluentBuilder
pub fn list_vector_buckets(&self) -> ListVectorBucketsFluentBuilder
Constructs a fluent builder for the ListVectorBuckets
operation.
This operation supports pagination; See into_paginator()
.
- The fluent builder is configurable:
max_results(i32)
/set_max_results(Option<i32>)
:
required: falseThe maximum number of vector buckets to be returned in the response.
next_token(impl Into<String>)
/set_next_token(Option<String>)
:
required: falseThe previous pagination token.
prefix(impl Into<String>)
/set_prefix(Option<String>)
:
required: falseLimits the response to vector buckets that begin with the specified prefix.
- On success, responds with
ListVectorBucketsOutput
with field(s):next_token(Option<String>)
:The element is included in the response when there are more buckets to be listed with pagination.
vector_buckets(Vec::<VectorBucketSummary>)
:The list of vector buckets owned by the requester.
- On failure, responds with
SdkError<ListVectorBucketsError>
Source§impl Client
impl Client
Sourcepub fn list_vectors(&self) -> ListVectorsFluentBuilder
pub fn list_vectors(&self) -> ListVectorsFluentBuilder
Constructs a fluent builder for the ListVectors
operation.
This operation supports pagination; See into_paginator()
.
- The fluent builder is configurable:
vector_bucket_name(impl Into<String>)
/set_vector_bucket_name(Option<String>)
:
required: falseThe name of the vector bucket.
index_name(impl Into<String>)
/set_index_name(Option<String>)
:
required: falseThe name of the vector index.
index_arn(impl Into<String>)
/set_index_arn(Option<String>)
:
required: falseThe Amazon resource Name (ARN) of the vector index.
max_results(i32)
/set_max_results(Option<i32>)
:
required: falseThe maximum number of vectors to return on a page.
If you don’t specify
maxResults
, theListVectors
operation uses a default value of 500.If the processed dataset size exceeds 1 MB before reaching the
maxResults
value, the operation stops and returns the vectors that are retrieved up to that point, along with anextToken
that you can use in a subsequent request to retrieve the next set of results.next_token(impl Into<String>)
/set_next_token(Option<String>)
:
required: falsePagination token from a previous request. The value of this field is empty for an initial request.
segment_count(i32)
/set_segment_count(Option<i32>)
:
required: falseFor a parallel
ListVectors
request,segmentCount
represents the total number of vector segments into which theListVectors
operation will be divided. The value ofsegmentCount
corresponds to the number of application workers that will perform the parallelListVectors
operation. For example, if you want to use four application threads to list vectors in a vector index, specify asegmentCount
value of 4.If you specify a
segmentCount
value of 1, theListVectors
operation will be sequential rather than parallel.If you specify
segmentCount
, you must also specifysegmentIndex
.segment_index(i32)
/set_segment_index(Option<i32>)
:
required: falseFor a parallel
ListVectors
request,segmentIndex
is the index of the segment from which to list vectors in the current request. It identifies an individual segment to be listed by an application worker.Segment IDs are zero-based, so the first segment is always 0. For example, if you want to use four application threads to list vectors in a vector index, then the first thread specifies a
segmentIndex
value of 0, the second thread specifies 1, and so on.The value of
segmentIndex
must be less than the value provided forsegmentCount
.If you provide
segmentIndex
, you must also providesegmentCount
.return_data(bool)
/set_return_data(Option<bool>)
:
required: falseIf true, the vector data of each vector will be included in the response. The default value is
false
.return_metadata(bool)
/set_return_metadata(Option<bool>)
:
required: falseIf true, the metadata associated with each vector will be included in the response. The default value is
false
.
- On success, responds with
ListVectorsOutput
with field(s):next_token(Option<String>)
:Pagination token to be used in the subsequent request. The field is empty if no further pagination is required.
vectors(Vec::<ListOutputVector>)
:Vectors in the current segment.
- On failure, responds with
SdkError<ListVectorsError>
Source§impl Client
impl Client
Sourcepub fn put_vector_bucket_policy(&self) -> PutVectorBucketPolicyFluentBuilder
pub fn put_vector_bucket_policy(&self) -> PutVectorBucketPolicyFluentBuilder
Constructs a fluent builder for the PutVectorBucketPolicy
operation.
- The fluent builder is configurable:
vector_bucket_name(impl Into<String>)
/set_vector_bucket_name(Option<String>)
:
required: falseThe name of the vector bucket.
vector_bucket_arn(impl Into<String>)
/set_vector_bucket_arn(Option<String>)
:
required: falseThe Amazon Resource Name (ARN) of the vector bucket.
policy(impl Into<String>)
/set_policy(Option<String>)
:
required: trueThe
JSON
that defines the policy. For more information about bucket policies for S3 Vectors, see Managing vector bucket policies in the Amazon S3 User Guide.
- On success, responds with
PutVectorBucketPolicyOutput
- On failure, responds with
SdkError<PutVectorBucketPolicyError>
Source§impl Client
impl Client
Sourcepub fn put_vectors(&self) -> PutVectorsFluentBuilder
pub fn put_vectors(&self) -> PutVectorsFluentBuilder
Constructs a fluent builder for the PutVectors
operation.
- The fluent builder is configurable:
vector_bucket_name(impl Into<String>)
/set_vector_bucket_name(Option<String>)
:
required: falseThe name of the vector bucket that contains the vector index.
index_name(impl Into<String>)
/set_index_name(Option<String>)
:
required: falseThe name of the vector index where you want to write vectors.
index_arn(impl Into<String>)
/set_index_arn(Option<String>)
:
required: falseThe ARN of the vector index where you want to write vectors.
vectors(PutInputVector)
/set_vectors(Option<Vec::<PutInputVector>>)
:
required: trueThe vectors to add to a vector index. The number of vectors in a single request must not exceed the resource capacity, otherwise the request will be rejected with the error
ServiceUnavailableException
with the error message “Currently unable to handle the request”.
- On success, responds with
PutVectorsOutput
- On failure, responds with
SdkError<PutVectorsError>
Source§impl Client
impl Client
Sourcepub fn query_vectors(&self) -> QueryVectorsFluentBuilder
pub fn query_vectors(&self) -> QueryVectorsFluentBuilder
Constructs a fluent builder for the QueryVectors
operation.
- The fluent builder is configurable:
vector_bucket_name(impl Into<String>)
/set_vector_bucket_name(Option<String>)
:
required: falseThe name of the vector bucket that contains the vector index.
index_name(impl Into<String>)
/set_index_name(Option<String>)
:
required: falseThe name of the vector index that you want to query.
index_arn(impl Into<String>)
/set_index_arn(Option<String>)
:
required: falseThe ARN of the vector index that you want to query.
top_k(i32)
/set_top_k(Option<i32>)
:
required: trueThe number of results to return for each query.
query_vector(VectorData)
/set_query_vector(Option<VectorData>)
:
required: trueThe query vector. Ensure that the query vector has the same dimension as the dimension of the vector index that’s being queried. For example, if your vector index contains vectors with 384 dimensions, your query vector must also have 384 dimensions.
filter(Document)
/set_filter(Option<Document>)
:
required: falseMetadata filter to apply during the query. For more information about metadata keys, see Metadata filtering in the Amazon S3 User Guide.
return_metadata(bool)
/set_return_metadata(Option<bool>)
:
required: falseIndicates whether to include metadata in the response. The default value is
false
.return_distance(bool)
/set_return_distance(Option<bool>)
:
required: falseIndicates whether to include the computed distance in the response. The default value is
false
.
- On success, responds with
QueryVectorsOutput
with field(s):vectors(Vec::<QueryOutputVector>)
:The vectors in the approximate nearest neighbor search.
- On failure, responds with
SdkError<QueryVectorsError>
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);