Struct Client

Source
pub struct Client { /* private fields */ }
Expand description

Client for Amazon Elastic File System

Client for invoking operations on Amazon Elastic File System. Each operation on Amazon Elastic File System 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_efs::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_efs::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 CreateAccessPoint operation has a Client::create_access_point, 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_access_point()
    .client_token("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

Source

pub fn create_access_point(&self) -> CreateAccessPointFluentBuilder

Constructs a fluent builder for the CreateAccessPoint operation.

Source§

impl Client

Source

pub fn create_file_system(&self) -> CreateFileSystemFluentBuilder

Constructs a fluent builder for the CreateFileSystem operation.

  • The fluent builder is configurable:
    • creation_token(impl Into<String>) / set_creation_token(Option<String>):
      required: true

      A string of up to 64 ASCII characters. Amazon EFS uses this to ensure idempotent creation.


    • performance_mode(PerformanceMode) / set_performance_mode(Option<PerformanceMode>):
      required: false

      The performance mode of the file system. We recommend generalPurpose performance mode for all file systems. File systems using the maxIO performance mode can scale to higher levels of aggregate throughput and operations per second with a tradeoff of slightly higher latencies for most file operations. The performance mode can’t be changed after the file system has been created. The maxIO mode is not supported on One Zone file systems.

      Due to the higher per-operation latencies with Max I/O, we recommend using General Purpose performance mode for all file systems.

      Default is generalPurpose.


    • encrypted(bool) / set_encrypted(Option<bool>):
      required: false

      A Boolean value that, if true, creates an encrypted file system. When creating an encrypted file system, you have the option of specifying an existing Key Management Service key (KMS key). If you don’t specify a KMS key, then the default KMS key for Amazon EFS, /aws/elasticfilesystem, is used to protect the encrypted file system.


    • kms_key_id(impl Into<String>) / set_kms_key_id(Option<String>):
      required: false

      The ID of the KMS key that you want to use to protect the encrypted file system. This parameter is required only if you want to use a non-default KMS key. If this parameter is not specified, the default KMS key for Amazon EFS is used. You can specify a KMS key ID using the following formats:

      • Key ID - A unique identifier of the key, for example 1234abcd-12ab-34cd-56ef-1234567890ab.

      • ARN - An Amazon Resource Name (ARN) for the key, for example arn:aws:kms:us-west-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab.

      • Key alias - A previously created display name for a key, for example alias/projectKey1.

      • Key alias ARN - An ARN for a key alias, for example arn:aws:kms:us-west-2:444455556666:alias/projectKey1.

      If you use KmsKeyId, you must set the CreateFileSystemRequest$Encrypted parameter to true.

      EFS accepts only symmetric KMS keys. You cannot use asymmetric KMS keys with Amazon EFS file systems.


    • throughput_mode(ThroughputMode) / set_throughput_mode(Option<ThroughputMode>):
      required: false

      Specifies the throughput mode for the file system. The mode can be bursting, provisioned, or elastic. If you set ThroughputMode to provisioned, you must also set a value for ProvisionedThroughputInMibps. After you create the file system, you can decrease your file system’s Provisioned throughput or change between the throughput modes, with certain time restrictions. For more information, see Specifying throughput with provisioned mode in the Amazon EFS User Guide.

      Default is bursting.


    • provisioned_throughput_in_mibps(f64) / set_provisioned_throughput_in_mibps(Option<f64>):
      required: false

      The throughput, measured in mebibytes per second (MiBps), that you want to provision for a file system that you’re creating. Required if ThroughputMode is set to provisioned. Valid values are 1-3414 MiBps, with the upper limit depending on Region. To increase this limit, contact Amazon Web Services Support. For more information, see Amazon EFS quotas that you can increase in the Amazon EFS User Guide.


    • availability_zone_name(impl Into<String>) / set_availability_zone_name(Option<String>):
      required: false

      For One Zone file systems, specify the Amazon Web Services Availability Zone in which to create the file system. Use the format us-east-1a to specify the Availability Zone. For more information about One Zone file systems, see EFS file system types in the Amazon EFS User Guide.

      One Zone file systems are not available in all Availability Zones in Amazon Web Services Regions where Amazon EFS is available.


    • backup(bool) / set_backup(Option<bool>):
      required: false

      Specifies whether automatic backups are enabled on the file system that you are creating. Set the value to true to enable automatic backups. If you are creating a One Zone file system, automatic backups are enabled by default. For more information, see Automatic backups in the Amazon EFS User Guide.

      Default is false. However, if you specify an AvailabilityZoneName, the default is true.

      Backup is not available in all Amazon Web Services Regions where Amazon EFS is available.


    • tags(Tag) / set_tags(Option<Vec::<Tag>>):
      required: false

      Use to create one or more tags associated with the file system. Each tag is a user-defined key-value pair. Name your file system on creation by including a “Key”:“Name”,“Value”:“{value}” key-value pair. Each key must be unique. For more information, see Tagging Amazon Web Services resources in the Amazon Web Services General Reference Guide.


  • On success, responds with CreateFileSystemOutput with field(s):
    • owner_id(String):

      The Amazon Web Services account that created the file system.

    • creation_token(String):

      The opaque string specified in the request.

    • file_system_id(String):

      The ID of the file system, assigned by Amazon EFS.

    • file_system_arn(Option<String>):

      The Amazon Resource Name (ARN) for the EFS file system, in the format arn:aws:elasticfilesystem:region:account-id:file-system/file-system-id . Example with sample data: arn:aws:elasticfilesystem:us-west-2:1111333322228888:file-system/fs-01234567

    • creation_time(DateTime):

      The time that the file system was created, in seconds (since 1970-01-01T00:00:00Z).

    • life_cycle_state(LifeCycleState):

      The lifecycle phase of the file system.

    • name(Option<String>):

      You can add tags to a file system, including a Name tag. For more information, see CreateFileSystem. If the file system has a Name tag, Amazon EFS returns the value in this field.

    • number_of_mount_targets(i32):

      The current number of mount targets that the file system has. For more information, see CreateMountTarget.

    • size_in_bytes(Option<FileSystemSize>):

      The latest known metered size (in bytes) of data stored in the file system, in its Value field, and the time at which that size was determined in its Timestamp field. The Timestamp value is the integer number of seconds since 1970-01-01T00:00:00Z. The SizeInBytes value doesn’t represent the size of a consistent snapshot of the file system, but it is eventually consistent when there are no writes to the file system. That is, SizeInBytes represents actual size only if the file system is not modified for a period longer than a couple of hours. Otherwise, the value is not the exact size that the file system was at any point in time.

    • performance_mode(PerformanceMode):

      The performance mode of the file system.

    • encrypted(Option<bool>):

      A Boolean value that, if true, indicates that the file system is encrypted.

    • kms_key_id(Option<String>):

      The ID of an KMS key used to protect the encrypted file system.

    • throughput_mode(Option<ThroughputMode>):

      Displays the file system’s throughput mode. For more information, see Throughput modes in the Amazon EFS User Guide.

    • provisioned_throughput_in_mibps(Option<f64>):

      The amount of provisioned throughput, measured in MiBps, for the file system. Valid for file systems using ThroughputMode set to provisioned.

    • availability_zone_name(Option<String>):

      Describes the Amazon Web Services Availability Zone in which the file system is located, and is valid only for One Zone file systems. For more information, see Using EFS storage classes in the Amazon EFS User Guide.

    • availability_zone_id(Option<String>):

      The unique and consistent identifier of the Availability Zone in which the file system is located, and is valid only for One Zone file systems. For example, use1-az1 is an Availability Zone ID for the us-east-1 Amazon Web Services Region, and it has the same location in every Amazon Web Services account.

    • tags(Vec::<Tag>):

      The tags associated with the file system, presented as an array of Tag objects.

    • file_system_protection(Option<FileSystemProtectionDescription>):

      Describes the protection on the file system.

  • On failure, responds with SdkError<CreateFileSystemError>
Source§

impl Client

Source

pub fn create_mount_target(&self) -> CreateMountTargetFluentBuilder

Constructs a fluent builder for the CreateMountTarget operation.

Source§

impl Client

Source

pub fn create_replication_configuration( &self, ) -> CreateReplicationConfigurationFluentBuilder

Constructs a fluent builder for the CreateReplicationConfiguration operation.

Source§

impl Client

Source

pub fn create_tags(&self) -> CreateTagsFluentBuilder

👎Deprecated: Use TagResource.

Constructs a fluent builder for the CreateTags operation.

Source§

impl Client

Source

pub fn delete_access_point(&self) -> DeleteAccessPointFluentBuilder

Constructs a fluent builder for the DeleteAccessPoint operation.

Source§

impl Client

Source

pub fn delete_file_system(&self) -> DeleteFileSystemFluentBuilder

Constructs a fluent builder for the DeleteFileSystem operation.

Source§

impl Client

Source

pub fn delete_file_system_policy(&self) -> DeleteFileSystemPolicyFluentBuilder

Constructs a fluent builder for the DeleteFileSystemPolicy operation.

Source§

impl Client

Source

pub fn delete_mount_target(&self) -> DeleteMountTargetFluentBuilder

Constructs a fluent builder for the DeleteMountTarget operation.

Source§

impl Client

Source

pub fn delete_replication_configuration( &self, ) -> DeleteReplicationConfigurationFluentBuilder

Constructs a fluent builder for the DeleteReplicationConfiguration operation.

  • The fluent builder is configurable:
    • source_file_system_id(impl Into<String>) / set_source_file_system_id(Option<String>):
      required: true

      The ID of the source file system in the replication configuration.


    • deletion_mode(DeletionMode) / set_deletion_mode(Option<DeletionMode>):
      required: false

      When replicating across Amazon Web Services accounts or across Amazon Web Services Regions, Amazon EFS deletes the replication configuration from both the source and destination account or Region (ALL_CONFIGURATIONS) by default. If there’s a configuration or permissions issue that prevents Amazon EFS from deleting the replication configuration from both sides, you can use the LOCAL_CONFIGURATION_ONLY mode to delete the replication configuration from only the local side (the account or Region from which the delete is performed).

      Only use the LOCAL_CONFIGURATION_ONLY mode in the case that Amazon EFS is unable to delete the replication configuration in both the source and destination account or Region. Deleting the local configuration leaves the configuration in the other account or Region unrecoverable.

      Additionally, do not use this mode for same-account, same-region replication as doing so results in a BadRequest exception error.


  • On success, responds with DeleteReplicationConfigurationOutput
  • On failure, responds with SdkError<DeleteReplicationConfigurationError>
Source§

impl Client

Source

pub fn delete_tags(&self) -> DeleteTagsFluentBuilder

👎Deprecated: Use UntagResource.

Constructs a fluent builder for the DeleteTags operation.

Source§

impl Client

Source

pub fn describe_access_points(&self) -> DescribeAccessPointsFluentBuilder

Constructs a fluent builder for the DescribeAccessPoints operation. This operation supports pagination; See into_paginator().

Source§

impl Client

Source

pub fn describe_account_preferences( &self, ) -> DescribeAccountPreferencesFluentBuilder

Constructs a fluent builder for the DescribeAccountPreferences operation.

Source§

impl Client

Source

pub fn describe_backup_policy(&self) -> DescribeBackupPolicyFluentBuilder

Constructs a fluent builder for the DescribeBackupPolicy operation.

Source§

impl Client

Source

pub fn describe_file_system_policy( &self, ) -> DescribeFileSystemPolicyFluentBuilder

Constructs a fluent builder for the DescribeFileSystemPolicy operation.

Source§

impl Client

Source

pub fn describe_file_systems(&self) -> DescribeFileSystemsFluentBuilder

Constructs a fluent builder for the DescribeFileSystems operation. This operation supports pagination; See into_paginator().

Source§

impl Client

Source

pub fn describe_lifecycle_configuration( &self, ) -> DescribeLifecycleConfigurationFluentBuilder

Constructs a fluent builder for the DescribeLifecycleConfiguration operation.

Source§

impl Client

Source

pub fn describe_mount_target_security_groups( &self, ) -> DescribeMountTargetSecurityGroupsFluentBuilder

Constructs a fluent builder for the DescribeMountTargetSecurityGroups operation.

Source§

impl Client

Source

pub fn describe_mount_targets(&self) -> DescribeMountTargetsFluentBuilder

Constructs a fluent builder for the DescribeMountTargets operation. This operation supports pagination; See into_paginator().

Source§

impl Client

Source

pub fn describe_replication_configurations( &self, ) -> DescribeReplicationConfigurationsFluentBuilder

Constructs a fluent builder for the DescribeReplicationConfigurations operation. This operation supports pagination; See into_paginator().

Source§

impl Client

Source

pub fn describe_tags(&self) -> DescribeTagsFluentBuilder

👎Deprecated: Use ListTagsForResource.

Constructs a fluent builder for the DescribeTags operation. This operation supports pagination; See into_paginator().

Source§

impl Client

Source

pub fn list_tags_for_resource(&self) -> ListTagsForResourceFluentBuilder

Constructs a fluent builder for the ListTagsForResource operation. This operation supports pagination; See into_paginator().

Source§

impl Client

Source

pub fn modify_mount_target_security_groups( &self, ) -> ModifyMountTargetSecurityGroupsFluentBuilder

Constructs a fluent builder for the ModifyMountTargetSecurityGroups operation.

Source§

impl Client

Source

pub fn put_account_preferences(&self) -> PutAccountPreferencesFluentBuilder

Constructs a fluent builder for the PutAccountPreferences operation.

Source§

impl Client

Source

pub fn put_backup_policy(&self) -> PutBackupPolicyFluentBuilder

Constructs a fluent builder for the PutBackupPolicy operation.

Source§

impl Client

Source

pub fn put_file_system_policy(&self) -> PutFileSystemPolicyFluentBuilder

Constructs a fluent builder for the PutFileSystemPolicy operation.

Source§

impl Client

Source

pub fn put_lifecycle_configuration( &self, ) -> PutLifecycleConfigurationFluentBuilder

Constructs a fluent builder for the PutLifecycleConfiguration operation.

  • The fluent builder is configurable:
    • file_system_id(impl Into<String>) / set_file_system_id(Option<String>):
      required: true

      The ID of the file system for which you are creating the LifecycleConfiguration object (String).


    • lifecycle_policies(LifecyclePolicy) / set_lifecycle_policies(Option<Vec::<LifecyclePolicy>>):
      required: true

      An array of LifecyclePolicy objects that define the file system’s LifecycleConfiguration object. A LifecycleConfiguration object informs lifecycle management of the following:

      • TransitionToIA – When to move files in the file system from primary storage (Standard storage class) into the Infrequent Access (IA) storage.

      • TransitionToArchive – When to move files in the file system from their current storage class (either IA or Standard storage) into the Archive storage.

        File systems cannot transition into Archive storage before transitioning into IA storage. Therefore, TransitionToArchive must either not be set or must be later than TransitionToIA.

        The Archive storage class is available only for file systems that use the Elastic throughput mode and the General Purpose performance mode.

      • TransitionToPrimaryStorageClass – Whether to move files in the file system back to primary storage (Standard storage class) after they are accessed in IA or Archive storage.

      When using the put-lifecycle-configuration CLI command or the PutLifecycleConfiguration API action, Amazon EFS requires that each LifecyclePolicy object have only a single transition. This means that in a request body, LifecyclePolicies must be structured as an array of LifecyclePolicy objects, one object for each storage transition. See the example requests in the following section for more information.


  • On success, responds with PutLifecycleConfigurationOutput with field(s):
  • On failure, responds with SdkError<PutLifecycleConfigurationError>
Source§

impl Client

Source

pub fn tag_resource(&self) -> TagResourceFluentBuilder

Constructs a fluent builder for the TagResource operation.

Source§

impl Client

Source

pub fn untag_resource(&self) -> UntagResourceFluentBuilder

Constructs a fluent builder for the UntagResource operation.

Source§

impl Client

Source

pub fn update_file_system(&self) -> UpdateFileSystemFluentBuilder

Constructs a fluent builder for the UpdateFileSystem operation.

Source§

impl Client

Source

pub fn update_file_system_protection( &self, ) -> UpdateFileSystemProtectionFluentBuilder

Constructs a fluent builder for the UpdateFileSystemProtection operation.

  • The fluent builder is configurable:
    • file_system_id(impl Into<String>) / set_file_system_id(Option<String>):
      required: true

      The ID of the file system to update.


    • replication_overwrite_protection(ReplicationOverwriteProtection) / set_replication_overwrite_protection(Option<ReplicationOverwriteProtection>):
      required: false

      The status of the file system’s replication overwrite protection.

      • ENABLED – The file system cannot be used as the destination file system in a replication configuration. The file system is writeable. Replication overwrite protection is ENABLED by default.

      • DISABLED – The file system can be used as the destination file system in a replication configuration. The file system is read-only and can only be modified by EFS replication.

      • REPLICATING – The file system is being used as the destination file system in a replication configuration. The file system is read-only and is only modified only by EFS replication.

      If the replication configuration is deleted, the file system’s replication overwrite protection is re-enabled and the file system becomes writeable.


  • On success, responds with UpdateFileSystemProtectionOutput with field(s):
    • replication_overwrite_protection(Option<ReplicationOverwriteProtection>):

      The status of the file system’s replication overwrite protection.

      • ENABLED – The file system cannot be used as the destination file system in a replication configuration. The file system is writeable. Replication overwrite protection is ENABLED by default.

      • DISABLED – The file system can be used as the destination file system in a replication configuration. The file system is read-only and can only be modified by EFS replication.

      • REPLICATING – The file system is being used as the destination file system in a replication configuration. The file system is read-only and is only modified only by EFS replication.

      If the replication configuration is deleted, the file system’s replication overwrite protection is re-enabled, the file system becomes writeable.

  • On failure, responds with SdkError<UpdateFileSystemProtectionError>
Source§

impl Client

Source

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 and time_source configured.
  • No behavior_version is provided.

The panic message for each of these will have instructions on how to resolve them.

Source

pub fn config(&self) -> &Config

Returns the client’s configuration.

Source§

impl Client

Source

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 the sleep_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 the http_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, set behavior_version on the Config or enable the behavior-version-latest Cargo feature.

Trait Implementations§

Source§

impl Clone for Client

Source§

fn clone(&self) -> Client

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Client

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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 more
Source§

impl<Unshared, Shared> IntoShared<Shared> for Unshared
where Shared: FromUnshared<Unshared>,

Source§

fn into_shared(self) -> Shared

Creates a shared type from an unshared type.
Source§

impl<T> Paint for T
where T: ?Sized,

Source§

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 primary(&self) -> Painted<&T>

Returns self with the fg() set to [Color :: Primary].

§Example
println!("{}", value.primary());
Source§

fn fixed(&self, color: u8) -> Painted<&T>

Returns self with the fg() set to [Color :: Fixed].

§Example
println!("{}", value.fixed(color));
Source§

fn rgb(&self, r: u8, g: u8, b: u8) -> Painted<&T>

Returns self with the fg() set to [Color :: Rgb].

§Example
println!("{}", value.rgb(r, g, b));
Source§

fn black(&self) -> Painted<&T>

Returns self with the fg() set to [Color :: Black].

§Example
println!("{}", value.black());
Source§

fn red(&self) -> Painted<&T>

Returns self with the fg() set to [Color :: Red].

§Example
println!("{}", value.red());
Source§

fn green(&self) -> Painted<&T>

Returns self with the fg() set to [Color :: Green].

§Example
println!("{}", value.green());
Source§

fn yellow(&self) -> Painted<&T>

Returns self with the fg() set to [Color :: Yellow].

§Example
println!("{}", value.yellow());
Source§

fn blue(&self) -> Painted<&T>

Returns self with the fg() set to [Color :: Blue].

§Example
println!("{}", value.blue());
Source§

fn magenta(&self) -> Painted<&T>

Returns self with the fg() set to [Color :: Magenta].

§Example
println!("{}", value.magenta());
Source§

fn cyan(&self) -> Painted<&T>

Returns self with the fg() set to [Color :: Cyan].

§Example
println!("{}", value.cyan());
Source§

fn white(&self) -> Painted<&T>

Returns self with the fg() set to [Color :: White].

§Example
println!("{}", value.white());
Source§

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>

Returns self with the fg() set to [Color :: BrightRed].

§Example
println!("{}", value.bright_red());
Source§

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>

Returns self with the fg() set to [Color :: BrightYellow].

§Example
println!("{}", value.bright_yellow());
Source§

fn bright_blue(&self) -> Painted<&T>

Returns self with the fg() set to [Color :: BrightBlue].

§Example
println!("{}", value.bright_blue());
Source§

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>

Returns self with the fg() set to [Color :: BrightCyan].

§Example
println!("{}", value.bright_cyan());
Source§

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>

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>

Returns self with the bg() set to [Color :: Primary].

§Example
println!("{}", value.on_primary());
Source§

fn on_fixed(&self, color: u8) -> Painted<&T>

Returns self with the bg() set to [Color :: Fixed].

§Example
println!("{}", value.on_fixed(color));
Source§

fn on_rgb(&self, r: u8, g: u8, b: u8) -> Painted<&T>

Returns self with the bg() set to [Color :: Rgb].

§Example
println!("{}", value.on_rgb(r, g, b));
Source§

fn on_black(&self) -> Painted<&T>

Returns self with the bg() set to [Color :: Black].

§Example
println!("{}", value.on_black());
Source§

fn on_red(&self) -> Painted<&T>

Returns self with the bg() set to [Color :: Red].

§Example
println!("{}", value.on_red());
Source§

fn on_green(&self) -> Painted<&T>

Returns self with the bg() set to [Color :: Green].

§Example
println!("{}", value.on_green());
Source§

fn on_yellow(&self) -> Painted<&T>

Returns self with the bg() set to [Color :: Yellow].

§Example
println!("{}", value.on_yellow());
Source§

fn on_blue(&self) -> Painted<&T>

Returns self with the bg() set to [Color :: Blue].

§Example
println!("{}", value.on_blue());
Source§

fn on_magenta(&self) -> Painted<&T>

Returns self with the bg() set to [Color :: Magenta].

§Example
println!("{}", value.on_magenta());
Source§

fn on_cyan(&self) -> Painted<&T>

Returns self with the bg() set to [Color :: Cyan].

§Example
println!("{}", value.on_cyan());
Source§

fn on_white(&self) -> Painted<&T>

Returns self with the bg() set to [Color :: White].

§Example
println!("{}", value.on_white());
Source§

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>

Returns self with the bg() set to [Color :: BrightRed].

§Example
println!("{}", value.on_bright_red());
Source§

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>

Returns self with the bg() set to [Color :: BrightYellow].

§Example
println!("{}", value.on_bright_yellow());
Source§

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>

Returns self with the bg() set to [Color :: BrightMagenta].

§Example
println!("{}", value.on_bright_magenta());
Source§

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>

Returns self with the bg() set to [Color :: BrightWhite].

§Example
println!("{}", value.on_bright_white());
Source§

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 bold(&self) -> Painted<&T>

Returns self with the attr() set to [Attribute :: Bold].

§Example
println!("{}", value.bold());
Source§

fn dim(&self) -> Painted<&T>

Returns self with the attr() set to [Attribute :: Dim].

§Example
println!("{}", value.dim());
Source§

fn italic(&self) -> Painted<&T>

Returns self with the attr() set to [Attribute :: Italic].

§Example
println!("{}", value.italic());
Source§

fn underline(&self) -> Painted<&T>

Returns self with the attr() set to [Attribute :: Underline].

§Example
println!("{}", value.underline());

Returns self with the attr() set to [Attribute :: Blink].

§Example
println!("{}", value.blink());

Returns self with the attr() set to [Attribute :: RapidBlink].

§Example
println!("{}", value.rapid_blink());
Source§

fn invert(&self) -> Painted<&T>

Returns self with the attr() set to [Attribute :: Invert].

§Example
println!("{}", value.invert());
Source§

fn conceal(&self) -> Painted<&T>

Returns self with the attr() set to [Attribute :: Conceal].

§Example
println!("{}", value.conceal());
Source§

fn strike(&self) -> Painted<&T>

Returns self with the attr() set to [Attribute :: Strike].

§Example
println!("{}", value.strike());
Source§

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 mask(&self) -> Painted<&T>

Returns self with the quirk() set to [Quirk :: Mask].

§Example
println!("{}", value.mask());
Source§

fn wrap(&self) -> Painted<&T>

Returns self with the quirk() set to [Quirk :: Wrap].

§Example
println!("{}", value.wrap());
Source§

fn linger(&self) -> Painted<&T>

Returns self with the quirk() set to [Quirk :: Linger].

§Example
println!("{}", value.linger());
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.

Returns self with the quirk() set to [Quirk :: Clear].

§Example
println!("{}", value.clear());
Source§

fn resetting(&self) -> Painted<&T>

Returns self with the quirk() set to [Quirk :: Resetting].

§Example
println!("{}", value.resetting());
Source§

fn bright(&self) -> Painted<&T>

Returns self with the quirk() set to [Quirk :: Bright].

§Example
println!("{}", value.bright());
Source§

fn on_bright(&self) -> Painted<&T>

Returns self with the quirk() set to [Quirk :: OnBright].

§Example
println!("{}", value.on_bright());
Source§

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);
Source§

fn new(self) -> Painted<Self>
where Self: Sized,

Create a new Painted with a default Style. Read more
Source§

fn paint<S>(&self, style: S) -> Painted<&Self>
where S: Into<Style>,

Apply a style wholesale to self. Any previous style is replaced. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,