pub struct Client { /* private fields */ }
Expand description
Client for Amazon Cognito Sync
Client for invoking operations on Amazon Cognito Sync. Each operation on Amazon Cognito Sync 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_cognitosync::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_cognitosync::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 BulkPublish
operation has
a Client::bulk_publish
, 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.bulk_publish()
.identity_pool_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 bulk_publish(&self) -> BulkPublishFluentBuilder
pub fn bulk_publish(&self) -> BulkPublishFluentBuilder
Constructs a fluent builder for the BulkPublish
operation.
- The fluent builder is configurable:
identity_pool_id(impl Into<String>)
/set_identity_pool_id(Option<String>)
:
required: true
A name-spaced GUID (for example, us-east-1:23EC4050-6AEA-7089-A2DD-08002EXAMPLE) created by Amazon Cognito. GUID generation is unique within a region.
- On success, responds with
BulkPublishOutput
with field(s):identity_pool_id(Option<String>)
: A name-spaced GUID (for example, us-east-1:23EC4050-6AEA-7089-A2DD-08002EXAMPLE) created by Amazon Cognito. GUID generation is unique within a region.
- On failure, responds with
SdkError<BulkPublishError>
Source§impl Client
impl Client
Sourcepub fn delete_dataset(&self) -> DeleteDatasetFluentBuilder
pub fn delete_dataset(&self) -> DeleteDatasetFluentBuilder
Constructs a fluent builder for the DeleteDataset
operation.
- The fluent builder is configurable:
identity_pool_id(impl Into<String>)
/set_identity_pool_id(Option<String>)
:
required: true
A name-spaced GUID (for example, us-east-1:23EC4050-6AEA-7089-A2DD-08002EXAMPLE) created by Amazon Cognito. GUID generation is unique within a region.identity_id(impl Into<String>)
/set_identity_id(Option<String>)
:
required: true
A name-spaced GUID (for example, us-east-1:23EC4050-6AEA-7089-A2DD-08002EXAMPLE) created by Amazon Cognito. GUID generation is unique within a region.dataset_name(impl Into<String>)
/set_dataset_name(Option<String>)
:
required: true
A string of up to 128 characters. Allowed characters are a-z, A-Z, 0-9, ‘_’ (underscore), ‘-’ (dash), and ‘.’ (dot).
- On success, responds with
DeleteDatasetOutput
with field(s):dataset(Option<Dataset>)
: A collection of data for an identity pool. An identity pool can have multiple datasets. A dataset is per identity and can be general or associated with a particular entity in an application (like a saved game). Datasets are automatically created if they don’t exist. Data is synced by dataset, and a dataset can hold up to 1MB of key-value pairs.
- On failure, responds with
SdkError<DeleteDatasetError>
Source§impl Client
impl Client
Sourcepub fn describe_dataset(&self) -> DescribeDatasetFluentBuilder
pub fn describe_dataset(&self) -> DescribeDatasetFluentBuilder
Constructs a fluent builder for the DescribeDataset
operation.
- The fluent builder is configurable:
identity_pool_id(impl Into<String>)
/set_identity_pool_id(Option<String>)
:
required: true
A name-spaced GUID (for example, us-east-1:23EC4050-6AEA-7089-A2DD-08002EXAMPLE) created by Amazon Cognito. GUID generation is unique within a region.identity_id(impl Into<String>)
/set_identity_id(Option<String>)
:
required: true
A name-spaced GUID (for example, us-east-1:23EC4050-6AEA-7089-A2DD-08002EXAMPLE) created by Amazon Cognito. GUID generation is unique within a region.dataset_name(impl Into<String>)
/set_dataset_name(Option<String>)
:
required: true
A string of up to 128 characters. Allowed characters are a-z, A-Z, 0-9, ‘_’ (underscore), ‘-’ (dash), and ‘.’ (dot).
- On success, responds with
DescribeDatasetOutput
with field(s):dataset(Option<Dataset>)
: Meta data for a collection of data for an identity. An identity can have multiple datasets. A dataset can be general or associated with a particular entity in an application (like a saved game). Datasets are automatically created if they don’t exist. Data is synced by dataset, and a dataset can hold up to 1MB of key-value pairs.
- On failure, responds with
SdkError<DescribeDatasetError>
Source§impl Client
impl Client
Sourcepub fn describe_identity_pool_usage(
&self,
) -> DescribeIdentityPoolUsageFluentBuilder
pub fn describe_identity_pool_usage( &self, ) -> DescribeIdentityPoolUsageFluentBuilder
Constructs a fluent builder for the DescribeIdentityPoolUsage
operation.
- The fluent builder is configurable:
identity_pool_id(impl Into<String>)
/set_identity_pool_id(Option<String>)
:
required: true
A name-spaced GUID (for example, us-east-1:23EC4050-6AEA-7089-A2DD-08002EXAMPLE) created by Amazon Cognito. GUID generation is unique within a region.
- On success, responds with
DescribeIdentityPoolUsageOutput
with field(s):identity_pool_usage(Option<IdentityPoolUsage>)
: Information about the usage of the identity pool.
- On failure, responds with
SdkError<DescribeIdentityPoolUsageError>
Source§impl Client
impl Client
Sourcepub fn describe_identity_usage(&self) -> DescribeIdentityUsageFluentBuilder
pub fn describe_identity_usage(&self) -> DescribeIdentityUsageFluentBuilder
Constructs a fluent builder for the DescribeIdentityUsage
operation.
- The fluent builder is configurable:
identity_pool_id(impl Into<String>)
/set_identity_pool_id(Option<String>)
:
required: true
A name-spaced GUID (for example, us-east-1:23EC4050-6AEA-7089-A2DD-08002EXAMPLE) created by Amazon Cognito. GUID generation is unique within a region.identity_id(impl Into<String>)
/set_identity_id(Option<String>)
:
required: true
A name-spaced GUID (for example, us-east-1:23EC4050-6AEA-7089-A2DD-08002EXAMPLE) created by Amazon Cognito. GUID generation is unique within a region.
- On success, responds with
DescribeIdentityUsageOutput
with field(s):identity_usage(Option<IdentityUsage>)
: Usage information for the identity.
- On failure, responds with
SdkError<DescribeIdentityUsageError>
Source§impl Client
impl Client
Sourcepub fn get_bulk_publish_details(&self) -> GetBulkPublishDetailsFluentBuilder
pub fn get_bulk_publish_details(&self) -> GetBulkPublishDetailsFluentBuilder
Constructs a fluent builder for the GetBulkPublishDetails
operation.
- The fluent builder is configurable:
identity_pool_id(impl Into<String>)
/set_identity_pool_id(Option<String>)
:
required: true
A name-spaced GUID (for example, us-east-1:23EC4050-6AEA-7089-A2DD-08002EXAMPLE) created by Amazon Cognito. GUID generation is unique within a region.
- On success, responds with
GetBulkPublishDetailsOutput
with field(s):identity_pool_id(Option<String>)
: A name-spaced GUID (for example, us-east-1:23EC4050-6AEA-7089-A2DD-08002EXAMPLE) created by Amazon Cognito. GUID generation is unique within a region.bulk_publish_start_time(Option<DateTime>)
: The date/time at which the last bulk publish was initiated.bulk_publish_complete_time(Option<DateTime>)
: If BulkPublishStatus is SUCCEEDED, the time the last bulk publish operation completed.bulk_publish_status(Option<BulkPublishStatus>)
: Status of the last bulk publish operation, valid values are:NOT_STARTED - No bulk publish has been requested for this identity pool
IN_PROGRESS - Data is being published to the configured stream
SUCCEEDED - All data for the identity pool has been published to the configured stream
FAILED - Some portion of the data has failed to publish, check FailureMessage for the cause.
failure_message(Option<String>)
: If BulkPublishStatus is FAILED this field will contain the error message that caused the bulk publish to fail.
- On failure, responds with
SdkError<GetBulkPublishDetailsError>
Source§impl Client
impl Client
Sourcepub fn get_cognito_events(&self) -> GetCognitoEventsFluentBuilder
pub fn get_cognito_events(&self) -> GetCognitoEventsFluentBuilder
Constructs a fluent builder for the GetCognitoEvents
operation.
- The fluent builder is configurable:
identity_pool_id(impl Into<String>)
/set_identity_pool_id(Option<String>)
:
required: trueThe Cognito Identity Pool ID for the request
- On success, responds with
GetCognitoEventsOutput
with field(s):events(Option<HashMap::<String, String>>)
:The Cognito Events returned from the GetCognitoEvents request
- On failure, responds with
SdkError<GetCognitoEventsError>
Source§impl Client
impl Client
Sourcepub fn get_identity_pool_configuration(
&self,
) -> GetIdentityPoolConfigurationFluentBuilder
pub fn get_identity_pool_configuration( &self, ) -> GetIdentityPoolConfigurationFluentBuilder
Constructs a fluent builder for the GetIdentityPoolConfiguration
operation.
- The fluent builder is configurable:
identity_pool_id(impl Into<String>)
/set_identity_pool_id(Option<String>)
:
required: trueA name-spaced GUID (for example, us-east-1:23EC4050-6AEA-7089-A2DD-08002EXAMPLE) created by Amazon Cognito. This is the ID of the pool for which to return a configuration.
- On success, responds with
GetIdentityPoolConfigurationOutput
with field(s):identity_pool_id(Option<String>)
:A name-spaced GUID (for example, us-east-1:23EC4050-6AEA-7089-A2DD-08002EXAMPLE) created by Amazon Cognito.
push_sync(Option<PushSync>)
:Options to apply to this identity pool for push synchronization.
cognito_streams(Option<CognitoStreams>)
: Options to apply to this identity pool for Amazon Cognito streams.
- On failure, responds with
SdkError<GetIdentityPoolConfigurationError>
Source§impl Client
impl Client
Sourcepub fn list_datasets(&self) -> ListDatasetsFluentBuilder
pub fn list_datasets(&self) -> ListDatasetsFluentBuilder
Constructs a fluent builder for the ListDatasets
operation.
- The fluent builder is configurable:
identity_pool_id(impl Into<String>)
/set_identity_pool_id(Option<String>)
:
required: true
A name-spaced GUID (for example, us-east-1:23EC4050-6AEA-7089-A2DD-08002EXAMPLE) created by Amazon Cognito. GUID generation is unique within a region.identity_id(impl Into<String>)
/set_identity_id(Option<String>)
:
required: true
A name-spaced GUID (for example, us-east-1:23EC4050-6AEA-7089-A2DD-08002EXAMPLE) created by Amazon Cognito. GUID generation is unique within a region.next_token(impl Into<String>)
/set_next_token(Option<String>)
:
required: false
A pagination token for obtaining the next page of results.max_results(i32)
/set_max_results(Option<i32>)
:
required: false
The maximum number of results to be returned.
- On success, responds with
ListDatasetsOutput
with field(s):datasets(Option<Vec::<Dataset>>)
: A set of datasets.count(i32)
: Number of datasets returned.next_token(Option<String>)
: A pagination token for obtaining the next page of results.
- On failure, responds with
SdkError<ListDatasetsError>
Source§impl Client
impl Client
Sourcepub fn list_identity_pool_usage(&self) -> ListIdentityPoolUsageFluentBuilder
pub fn list_identity_pool_usage(&self) -> ListIdentityPoolUsageFluentBuilder
Constructs a fluent builder for the ListIdentityPoolUsage
operation.
- The fluent builder is configurable:
next_token(impl Into<String>)
/set_next_token(Option<String>)
:
required: false
A pagination token for obtaining the next page of results.max_results(i32)
/set_max_results(Option<i32>)
:
required: false
The maximum number of results to be returned.
- On success, responds with
ListIdentityPoolUsageOutput
with field(s):identity_pool_usages(Option<Vec::<IdentityPoolUsage>>)
: Usage information for the identity pools.max_results(i32)
: The maximum number of results to be returned.count(i32)
: Total number of identities for the identity pool.next_token(Option<String>)
: A pagination token for obtaining the next page of results.
- On failure, responds with
SdkError<ListIdentityPoolUsageError>
Source§impl Client
impl Client
Sourcepub fn list_records(&self) -> ListRecordsFluentBuilder
pub fn list_records(&self) -> ListRecordsFluentBuilder
Constructs a fluent builder for the ListRecords
operation.
- The fluent builder is configurable:
identity_pool_id(impl Into<String>)
/set_identity_pool_id(Option<String>)
:
required: true
A name-spaced GUID (for example, us-east-1:23EC4050-6AEA-7089-A2DD-08002EXAMPLE) created by Amazon Cognito. GUID generation is unique within a region.identity_id(impl Into<String>)
/set_identity_id(Option<String>)
:
required: true
A name-spaced GUID (for example, us-east-1:23EC4050-6AEA-7089-A2DD-08002EXAMPLE) created by Amazon Cognito. GUID generation is unique within a region.dataset_name(impl Into<String>)
/set_dataset_name(Option<String>)
:
required: true
A string of up to 128 characters. Allowed characters are a-z, A-Z, 0-9, ‘_’ (underscore), ‘-’ (dash), and ‘.’ (dot).last_sync_count(i64)
/set_last_sync_count(Option<i64>)
:
required: false
The last server sync count for this record.next_token(impl Into<String>)
/set_next_token(Option<String>)
:
required: false
A pagination token for obtaining the next page of results.max_results(i32)
/set_max_results(Option<i32>)
:
required: false
The maximum number of results to be returned.sync_session_token(impl Into<String>)
/set_sync_session_token(Option<String>)
:
required: false
A token containing a session ID, identity ID, and expiration.
- On success, responds with
ListRecordsOutput
with field(s):records(Option<Vec::<Record>>)
: A list of all records.next_token(Option<String>)
: A pagination token for obtaining the next page of results.count(i32)
: Total number of records.dataset_sync_count(Option<i64>)
: Server sync count for this dataset.last_modified_by(Option<String>)
: The user/device that made the last change to this record.merged_dataset_names(Option<Vec::<String>>)
: Names of merged datasets.dataset_exists(bool)
: Indicates whether the dataset exists.dataset_deleted_after_requested_sync_count(bool)
: A boolean value specifying whether to delete the dataset locally.sync_session_token(Option<String>)
: A token containing a session ID, identity ID, and expiration.
- On failure, responds with
SdkError<ListRecordsError>
Source§impl Client
impl Client
Sourcepub fn register_device(&self) -> RegisterDeviceFluentBuilder
pub fn register_device(&self) -> RegisterDeviceFluentBuilder
Constructs a fluent builder for the RegisterDevice
operation.
- The fluent builder is configurable:
identity_pool_id(impl Into<String>)
/set_identity_pool_id(Option<String>)
:
required: trueA name-spaced GUID (for example, us-east-1:23EC4050-6AEA-7089-A2DD-08002EXAMPLE) created by Amazon Cognito. Here, the ID of the pool that the identity belongs to.
identity_id(impl Into<String>)
/set_identity_id(Option<String>)
:
required: trueThe unique ID for this identity.
platform(Platform)
/set_platform(Option<Platform>)
:
required: trueThe SNS platform type (e.g. GCM, SDM, APNS, APNS_SANDBOX).
token(impl Into<String>)
/set_token(Option<String>)
:
required: trueThe push token.
- On success, responds with
RegisterDeviceOutput
with field(s):device_id(Option<String>)
:The unique ID generated for this device by Cognito.
- On failure, responds with
SdkError<RegisterDeviceError>
Source§impl Client
impl Client
Sourcepub fn set_cognito_events(&self) -> SetCognitoEventsFluentBuilder
pub fn set_cognito_events(&self) -> SetCognitoEventsFluentBuilder
Constructs a fluent builder for the SetCognitoEvents
operation.
- The fluent builder is configurable:
identity_pool_id(impl Into<String>)
/set_identity_pool_id(Option<String>)
:
required: trueThe Cognito Identity Pool to use when configuring Cognito Events
events(impl Into<String>, impl Into<String>)
/set_events(Option<HashMap::<String, String>>)
:
required: trueThe events to configure
- On success, responds with
SetCognitoEventsOutput
- On failure, responds with
SdkError<SetCognitoEventsError>
Source§impl Client
impl Client
Sourcepub fn set_identity_pool_configuration(
&self,
) -> SetIdentityPoolConfigurationFluentBuilder
pub fn set_identity_pool_configuration( &self, ) -> SetIdentityPoolConfigurationFluentBuilder
Constructs a fluent builder for the SetIdentityPoolConfiguration
operation.
- The fluent builder is configurable:
identity_pool_id(impl Into<String>)
/set_identity_pool_id(Option<String>)
:
required: trueA name-spaced GUID (for example, us-east-1:23EC4050-6AEA-7089-A2DD-08002EXAMPLE) created by Amazon Cognito. This is the ID of the pool to modify.
push_sync(PushSync)
/set_push_sync(Option<PushSync>)
:
required: falseOptions to apply to this identity pool for push synchronization.
cognito_streams(CognitoStreams)
/set_cognito_streams(Option<CognitoStreams>)
:
required: false
Options to apply to this identity pool for Amazon Cognito streams.
- On success, responds with
SetIdentityPoolConfigurationOutput
with field(s):identity_pool_id(Option<String>)
:A name-spaced GUID (for example, us-east-1:23EC4050-6AEA-7089-A2DD-08002EXAMPLE) created by Amazon Cognito.
push_sync(Option<PushSync>)
:Options to apply to this identity pool for push synchronization.
cognito_streams(Option<CognitoStreams>)
: Options to apply to this identity pool for Amazon Cognito streams.
- On failure, responds with
SdkError<SetIdentityPoolConfigurationError>
Source§impl Client
impl Client
Sourcepub fn subscribe_to_dataset(&self) -> SubscribeToDatasetFluentBuilder
pub fn subscribe_to_dataset(&self) -> SubscribeToDatasetFluentBuilder
Constructs a fluent builder for the SubscribeToDataset
operation.
- The fluent builder is configurable:
identity_pool_id(impl Into<String>)
/set_identity_pool_id(Option<String>)
:
required: trueA name-spaced GUID (for example, us-east-1:23EC4050-6AEA-7089-A2DD-08002EXAMPLE) created by Amazon Cognito. The ID of the pool to which the identity belongs.
identity_id(impl Into<String>)
/set_identity_id(Option<String>)
:
required: trueUnique ID for this identity.
dataset_name(impl Into<String>)
/set_dataset_name(Option<String>)
:
required: trueThe name of the dataset to subcribe to.
device_id(impl Into<String>)
/set_device_id(Option<String>)
:
required: trueThe unique ID generated for this device by Cognito.
- On success, responds with
SubscribeToDatasetOutput
- On failure, responds with
SdkError<SubscribeToDatasetError>
Source§impl Client
impl Client
Sourcepub fn unsubscribe_from_dataset(&self) -> UnsubscribeFromDatasetFluentBuilder
pub fn unsubscribe_from_dataset(&self) -> UnsubscribeFromDatasetFluentBuilder
Constructs a fluent builder for the UnsubscribeFromDataset
operation.
- The fluent builder is configurable:
identity_pool_id(impl Into<String>)
/set_identity_pool_id(Option<String>)
:
required: trueA name-spaced GUID (for example, us-east-1:23EC4050-6AEA-7089-A2DD-08002EXAMPLE) created by Amazon Cognito. The ID of the pool to which this identity belongs.
identity_id(impl Into<String>)
/set_identity_id(Option<String>)
:
required: trueUnique ID for this identity.
dataset_name(impl Into<String>)
/set_dataset_name(Option<String>)
:
required: trueThe name of the dataset from which to unsubcribe.
device_id(impl Into<String>)
/set_device_id(Option<String>)
:
required: trueThe unique ID generated for this device by Cognito.
- On success, responds with
UnsubscribeFromDatasetOutput
- On failure, responds with
SdkError<UnsubscribeFromDatasetError>
Source§impl Client
impl Client
Sourcepub fn update_records(&self) -> UpdateRecordsFluentBuilder
pub fn update_records(&self) -> UpdateRecordsFluentBuilder
Constructs a fluent builder for the UpdateRecords
operation.
- The fluent builder is configurable:
identity_pool_id(impl Into<String>)
/set_identity_pool_id(Option<String>)
:
required: true
A name-spaced GUID (for example, us-east-1:23EC4050-6AEA-7089-A2DD-08002EXAMPLE) created by Amazon Cognito. GUID generation is unique within a region.identity_id(impl Into<String>)
/set_identity_id(Option<String>)
:
required: true
A name-spaced GUID (for example, us-east-1:23EC4050-6AEA-7089-A2DD-08002EXAMPLE) created by Amazon Cognito. GUID generation is unique within a region.dataset_name(impl Into<String>)
/set_dataset_name(Option<String>)
:
required: true
A string of up to 128 characters. Allowed characters are a-z, A-Z, 0-9, ‘_’ (underscore), ‘-’ (dash), and ‘.’ (dot).device_id(impl Into<String>)
/set_device_id(Option<String>)
:
required: falseThe unique ID generated for this device by Cognito.
record_patches(RecordPatch)
/set_record_patches(Option<Vec::<RecordPatch>>)
:
required: false
A list of patch operations.sync_session_token(impl Into<String>)
/set_sync_session_token(Option<String>)
:
required: true
The SyncSessionToken returned by a previous call to ListRecords for this dataset and identity.client_context(impl Into<String>)
/set_client_context(Option<String>)
:
required: false
Intended to supply a device ID that will populate the lastModifiedBy field referenced in other methods. The ClientContext field is not yet implemented.
- On success, responds with
UpdateRecordsOutput
with field(s):records(Option<Vec::<Record>>)
: A list of records that have been updated.
- On failure, responds with
SdkError<UpdateRecordsError>
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>
Returns self
with the
fg()
set to
Color::BrightBlack
.
§Example
println!("{}", value.bright_black());
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>
Returns self
with the
fg()
set to
Color::BrightGreen
.
§Example
println!("{}", value.bright_green());
Source§fn bright_yellow(&self) -> Painted<&T>
fn bright_yellow(&self) -> Painted<&T>
Returns self
with the
fg()
set to
Color::BrightYellow
.
§Example
println!("{}", value.bright_yellow());
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>
Returns self
with the
fg()
set to
Color::BrightMagenta
.
§Example
println!("{}", value.bright_magenta());
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>
Returns self
with the
fg()
set to
Color::BrightWhite
.
§Example
println!("{}", value.bright_white());
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>
Returns self
with the
bg()
set to
Color::BrightBlack
.
§Example
println!("{}", value.on_bright_black());
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>
Returns self
with the
bg()
set to
Color::BrightGreen
.
§Example
println!("{}", value.on_bright_green());
Source§fn on_bright_yellow(&self) -> Painted<&T>
fn on_bright_yellow(&self) -> Painted<&T>
Returns self
with the
bg()
set to
Color::BrightYellow
.
§Example
println!("{}", value.on_bright_yellow());
Source§fn on_bright_blue(&self) -> Painted<&T>
fn on_bright_blue(&self) -> Painted<&T>
Returns self
with the
bg()
set to
Color::BrightBlue
.
§Example
println!("{}", value.on_bright_blue());
Source§fn on_bright_magenta(&self) -> Painted<&T>
fn on_bright_magenta(&self) -> Painted<&T>
Returns self
with the
bg()
set to
Color::BrightMagenta
.
§Example
println!("{}", value.on_bright_magenta());
Source§fn on_bright_cyan(&self) -> Painted<&T>
fn on_bright_cyan(&self) -> Painted<&T>
Returns self
with the
bg()
set to
Color::BrightCyan
.
§Example
println!("{}", value.on_bright_cyan());
Source§fn on_bright_white(&self) -> Painted<&T>
fn on_bright_white(&self) -> Painted<&T>
Returns self
with the
bg()
set to
Color::BrightWhite
.
§Example
println!("{}", value.on_bright_white());
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 underline(&self) -> Painted<&T>
fn underline(&self) -> Painted<&T>
Returns self
with the
attr()
set to
Attribute::Underline
.
§Example
println!("{}", value.underline());
Source§fn rapid_blink(&self) -> Painted<&T>
fn rapid_blink(&self) -> Painted<&T>
Returns self
with the
attr()
set to
Attribute::RapidBlink
.
§Example
println!("{}", value.rapid_blink());
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);