pub struct Client { /* private fields */ }
Expand description
Client for Amazon OpenSearch Ingestion
Client for invoking operations on Amazon OpenSearch Ingestion. Each operation on Amazon OpenSearch Ingestion 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_osis::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_osis::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 CreatePipeline
operation has
a Client::create_pipeline
, 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_pipeline()
.pipeline_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_pipeline(&self) -> CreatePipelineFluentBuilder
pub fn create_pipeline(&self) -> CreatePipelineFluentBuilder
Constructs a fluent builder for the CreatePipeline
operation.
- The fluent builder is configurable:
pipeline_name(impl Into<String>)
/set_pipeline_name(Option<String>)
:
required: trueThe name of the OpenSearch Ingestion pipeline to create. Pipeline names are unique across the pipelines owned by an account within an Amazon Web Services Region.
min_units(i32)
/set_min_units(Option<i32>)
:
required: trueThe minimum pipeline capacity, in Ingestion Compute Units (ICUs).
max_units(i32)
/set_max_units(Option<i32>)
:
required: trueThe maximum pipeline capacity, in Ingestion Compute Units (ICUs).
pipeline_configuration_body(impl Into<String>)
/set_pipeline_configuration_body(Option<String>)
:
required: trueThe pipeline configuration in YAML format. The command accepts the pipeline configuration as a string or within a .yaml file. If you provide the configuration as a string, each new line must be escaped with
\n
.log_publishing_options(LogPublishingOptions)
/set_log_publishing_options(Option<LogPublishingOptions>)
:
required: falseKey-value pairs to configure log publishing.
vpc_options(VpcOptions)
/set_vpc_options(Option<VpcOptions>)
:
required: falseContainer for the values required to configure VPC access for the pipeline. If you don’t specify these values, OpenSearch Ingestion creates the pipeline with a public endpoint.
buffer_options(BufferOptions)
/set_buffer_options(Option<BufferOptions>)
:
required: falseKey-value pairs to configure persistent buffering for the pipeline.
encryption_at_rest_options(EncryptionAtRestOptions)
/set_encryption_at_rest_options(Option<EncryptionAtRestOptions>)
:
required: falseKey-value pairs to configure encryption for data that is written to a persistent buffer.
tags(Tag)
/set_tags(Option<Vec::<Tag>>)
:
required: falseList of tags to add to the pipeline upon creation.
pipeline_role_arn(impl Into<String>)
/set_pipeline_role_arn(Option<String>)
:
required: falseThe Amazon Resource Name (ARN) of the IAM role that grants the pipeline permission to access Amazon Web Services resources.
- On success, responds with
CreatePipelineOutput
with field(s):pipeline(Option<Pipeline>)
:Container for information about the created pipeline.
- On failure, responds with
SdkError<CreatePipelineError>
Source§impl Client
impl Client
Sourcepub fn create_pipeline_endpoint(&self) -> CreatePipelineEndpointFluentBuilder
pub fn create_pipeline_endpoint(&self) -> CreatePipelineEndpointFluentBuilder
Constructs a fluent builder for the CreatePipelineEndpoint
operation.
- The fluent builder is configurable:
pipeline_arn(impl Into<String>)
/set_pipeline_arn(Option<String>)
:
required: trueThe Amazon Resource Name (ARN) of the pipeline to create the endpoint for.
vpc_options(PipelineEndpointVpcOptions)
/set_vpc_options(Option<PipelineEndpointVpcOptions>)
:
required: trueContainer for the VPC configuration for the pipeline endpoint, including subnet IDs and security group IDs.
- On success, responds with
CreatePipelineEndpointOutput
with field(s):pipeline_arn(Option<String>)
:The Amazon Resource Name (ARN) of the pipeline associated with the endpoint.
endpoint_id(Option<String>)
:The unique identifier of the pipeline endpoint.
status(Option<PipelineEndpointStatus>)
:The current status of the pipeline endpoint.
vpc_id(Option<String>)
:The ID of the VPC where the pipeline endpoint was created.
- On failure, responds with
SdkError<CreatePipelineEndpointError>
Source§impl Client
impl Client
Sourcepub fn delete_pipeline(&self) -> DeletePipelineFluentBuilder
pub fn delete_pipeline(&self) -> DeletePipelineFluentBuilder
Constructs a fluent builder for the DeletePipeline
operation.
- The fluent builder is configurable:
pipeline_name(impl Into<String>)
/set_pipeline_name(Option<String>)
:
required: trueThe name of the pipeline to delete.
- On success, responds with
DeletePipelineOutput
- On failure, responds with
SdkError<DeletePipelineError>
Source§impl Client
impl Client
Sourcepub fn delete_pipeline_endpoint(&self) -> DeletePipelineEndpointFluentBuilder
pub fn delete_pipeline_endpoint(&self) -> DeletePipelineEndpointFluentBuilder
Constructs a fluent builder for the DeletePipelineEndpoint
operation.
- The fluent builder is configurable:
endpoint_id(impl Into<String>)
/set_endpoint_id(Option<String>)
:
required: trueThe unique identifier of the pipeline endpoint to delete.
- On success, responds with
DeletePipelineEndpointOutput
- On failure, responds with
SdkError<DeletePipelineEndpointError>
Source§impl Client
impl Client
Sourcepub fn delete_resource_policy(&self) -> DeleteResourcePolicyFluentBuilder
pub fn delete_resource_policy(&self) -> DeleteResourcePolicyFluentBuilder
Constructs a fluent builder for the DeleteResourcePolicy
operation.
- The fluent builder is configurable:
resource_arn(impl Into<String>)
/set_resource_arn(Option<String>)
:
required: trueThe Amazon Resource Name (ARN) of the resource from which to delete the policy.
- On success, responds with
DeleteResourcePolicyOutput
- On failure, responds with
SdkError<DeleteResourcePolicyError>
Source§impl Client
impl Client
Sourcepub fn get_pipeline(&self) -> GetPipelineFluentBuilder
pub fn get_pipeline(&self) -> GetPipelineFluentBuilder
Constructs a fluent builder for the GetPipeline
operation.
- The fluent builder is configurable:
pipeline_name(impl Into<String>)
/set_pipeline_name(Option<String>)
:
required: trueThe name of the pipeline.
- On success, responds with
GetPipelineOutput
with field(s):pipeline(Option<Pipeline>)
:Detailed information about the requested pipeline.
- On failure, responds with
SdkError<GetPipelineError>
Source§impl Client
impl Client
Sourcepub fn get_pipeline_blueprint(&self) -> GetPipelineBlueprintFluentBuilder
pub fn get_pipeline_blueprint(&self) -> GetPipelineBlueprintFluentBuilder
Constructs a fluent builder for the GetPipelineBlueprint
operation.
- The fluent builder is configurable:
blueprint_name(impl Into<String>)
/set_blueprint_name(Option<String>)
:
required: trueThe name of the blueprint to retrieve.
format(impl Into<String>)
/set_format(Option<String>)
:
required: falseThe format format of the blueprint to retrieve.
- On success, responds with
GetPipelineBlueprintOutput
with field(s):blueprint(Option<PipelineBlueprint>)
:The requested blueprint in YAML format.
format(Option<String>)
:The format of the blueprint.
- On failure, responds with
SdkError<GetPipelineBlueprintError>
Source§impl Client
impl Client
Sourcepub fn get_pipeline_change_progress(
&self,
) -> GetPipelineChangeProgressFluentBuilder
pub fn get_pipeline_change_progress( &self, ) -> GetPipelineChangeProgressFluentBuilder
Constructs a fluent builder for the GetPipelineChangeProgress
operation.
- The fluent builder is configurable:
pipeline_name(impl Into<String>)
/set_pipeline_name(Option<String>)
:
required: trueThe name of the pipeline.
- On success, responds with
GetPipelineChangeProgressOutput
with field(s):change_progress_statuses(Option<Vec::<ChangeProgressStatus>>)
:The current status of the change happening on the pipeline.
- On failure, responds with
SdkError<GetPipelineChangeProgressError>
Source§impl Client
impl Client
Sourcepub fn get_resource_policy(&self) -> GetResourcePolicyFluentBuilder
pub fn get_resource_policy(&self) -> GetResourcePolicyFluentBuilder
Constructs a fluent builder for the GetResourcePolicy
operation.
- The fluent builder is configurable:
resource_arn(impl Into<String>)
/set_resource_arn(Option<String>)
:
required: trueThe Amazon Resource Name (ARN) of the resource for which to retrieve the policy.
- On success, responds with
GetResourcePolicyOutput
with field(s):resource_arn(Option<String>)
:The Amazon Resource Name (ARN) of the resource.
policy(Option<String>)
:The resource-based policy document in JSON format.
- On failure, responds with
SdkError<GetResourcePolicyError>
Source§impl Client
impl Client
Sourcepub fn list_pipeline_blueprints(&self) -> ListPipelineBlueprintsFluentBuilder
pub fn list_pipeline_blueprints(&self) -> ListPipelineBlueprintsFluentBuilder
Constructs a fluent builder for the ListPipelineBlueprints
operation.
- The fluent builder takes no input, just
send
it. - On success, responds with
ListPipelineBlueprintsOutput
with field(s):blueprints(Option<Vec::<PipelineBlueprintSummary>>)
:A list of available blueprints for Data Prepper.
- On failure, responds with
SdkError<ListPipelineBlueprintsError>
Source§impl Client
impl Client
Sourcepub fn list_pipeline_endpoint_connections(
&self,
) -> ListPipelineEndpointConnectionsFluentBuilder
pub fn list_pipeline_endpoint_connections( &self, ) -> ListPipelineEndpointConnectionsFluentBuilder
Constructs a fluent builder for the ListPipelineEndpointConnections
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 pipeline endpoint connections to return in the response.
next_token(impl Into<String>)
/set_next_token(Option<String>)
:
required: falseIf your initial
ListPipelineEndpointConnections
operation returns anextToken
, you can include the returnednextToken
in subsequentListPipelineEndpointConnections
operations, which returns results in the next page.
- On success, responds with
ListPipelineEndpointConnectionsOutput
with field(s):next_token(Option<String>)
:When
nextToken
is returned, there are more results available. The value ofnextToken
is a unique pagination token for each page. Make the call again using the returned token to retrieve the next page.pipeline_endpoint_connections(Option<Vec::<PipelineEndpointConnection>>)
:A list of pipeline endpoint connections.
- On failure, responds with
SdkError<ListPipelineEndpointConnectionsError>
Source§impl Client
impl Client
Sourcepub fn list_pipeline_endpoints(&self) -> ListPipelineEndpointsFluentBuilder
pub fn list_pipeline_endpoints(&self) -> ListPipelineEndpointsFluentBuilder
Constructs a fluent builder for the ListPipelineEndpoints
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 pipeline endpoints to return in the response.
next_token(impl Into<String>)
/set_next_token(Option<String>)
:
required: falseIf your initial
ListPipelineEndpoints
operation returns aNextToken
, you can include the returnedNextToken
in subsequentListPipelineEndpoints
operations, which returns results in the next page.
- On success, responds with
ListPipelineEndpointsOutput
with field(s):next_token(Option<String>)
:When
NextToken
is returned, there are more results available. The value ofNextToken
is a unique pagination token for each page. Make the call again using the returned token to retrieve the next page.pipeline_endpoints(Option<Vec::<PipelineEndpoint>>)
:A list of pipeline endpoints.
- On failure, responds with
SdkError<ListPipelineEndpointsError>
Source§impl Client
impl Client
Sourcepub fn list_pipelines(&self) -> ListPipelinesFluentBuilder
pub fn list_pipelines(&self) -> ListPipelinesFluentBuilder
Constructs a fluent builder for the ListPipelines
operation.
This operation supports pagination; See into_paginator()
.
- The fluent builder is configurable:
max_results(i32)
/set_max_results(Option<i32>)
:
required: falseAn optional parameter that specifies the maximum number of results to return. You can use
nextToken
to get the next page of results.next_token(impl Into<String>)
/set_next_token(Option<String>)
:
required: falseIf your initial
ListPipelines
operation returns anextToken
, you can include the returnednextToken
in subsequentListPipelines
operations, which returns results in the next page.
- On success, responds with
ListPipelinesOutput
with field(s):next_token(Option<String>)
:When
nextToken
is returned, there are more results available. The value ofnextToken
is a unique pagination token for each page. Make the call again using the returned token to retrieve the next page.pipelines(Option<Vec::<PipelineSummary>>)
:A list of all existing Data Prepper pipelines.
- On failure, responds with
SdkError<ListPipelinesError>
Source§impl Client
impl Client
Constructs a fluent builder for the ListTagsForResource
operation.
- The fluent builder is configurable:
arn(impl Into<String>)
/set_arn(Option<String>)
:
required: trueThe Amazon Resource Name (ARN) of the pipeline to retrieve tags for.
- On success, responds with
ListTagsForResourceOutput
with field(s):tags(Option<Vec::<Tag>>)
:A list of tags associated with the given pipeline.
- On failure, responds with
SdkError<ListTagsForResourceError>
Source§impl Client
impl Client
Sourcepub fn put_resource_policy(&self) -> PutResourcePolicyFluentBuilder
pub fn put_resource_policy(&self) -> PutResourcePolicyFluentBuilder
Constructs a fluent builder for the PutResourcePolicy
operation.
- The fluent builder is configurable:
resource_arn(impl Into<String>)
/set_resource_arn(Option<String>)
:
required: trueThe Amazon Resource Name (ARN) of the resource to attach the policy to.
policy(impl Into<String>)
/set_policy(Option<String>)
:
required: trueThe resource-based policy document in JSON format.
- On success, responds with
PutResourcePolicyOutput
with field(s):resource_arn(Option<String>)
:The Amazon Resource Name (ARN) of the resource.
policy(Option<String>)
:The resource-based policy document that was attached to the resource.
- On failure, responds with
SdkError<PutResourcePolicyError>
Source§impl Client
impl Client
Sourcepub fn revoke_pipeline_endpoint_connections(
&self,
) -> RevokePipelineEndpointConnectionsFluentBuilder
pub fn revoke_pipeline_endpoint_connections( &self, ) -> RevokePipelineEndpointConnectionsFluentBuilder
Constructs a fluent builder for the RevokePipelineEndpointConnections
operation.
- The fluent builder is configurable:
pipeline_arn(impl Into<String>)
/set_pipeline_arn(Option<String>)
:
required: trueThe Amazon Resource Name (ARN) of the pipeline from which to revoke endpoint connections.
endpoint_ids(impl Into<String>)
/set_endpoint_ids(Option<Vec::<String>>)
:
required: trueA list of endpoint IDs for which to revoke access to the pipeline.
- On success, responds with
RevokePipelineEndpointConnectionsOutput
with field(s):pipeline_arn(Option<String>)
:The Amazon Resource Name (ARN) of the pipeline from which endpoint connections were revoked.
- On failure, responds with
SdkError<RevokePipelineEndpointConnectionsError>
Source§impl Client
impl Client
Sourcepub fn start_pipeline(&self) -> StartPipelineFluentBuilder
pub fn start_pipeline(&self) -> StartPipelineFluentBuilder
Constructs a fluent builder for the StartPipeline
operation.
- The fluent builder is configurable:
pipeline_name(impl Into<String>)
/set_pipeline_name(Option<String>)
:
required: trueThe name of the pipeline to start.
- On success, responds with
StartPipelineOutput
with field(s):pipeline(Option<Pipeline>)
:Information about an existing OpenSearch Ingestion pipeline.
- On failure, responds with
SdkError<StartPipelineError>
Source§impl Client
impl Client
Sourcepub fn stop_pipeline(&self) -> StopPipelineFluentBuilder
pub fn stop_pipeline(&self) -> StopPipelineFluentBuilder
Constructs a fluent builder for the StopPipeline
operation.
- The fluent builder is configurable:
pipeline_name(impl Into<String>)
/set_pipeline_name(Option<String>)
:
required: trueThe name of the pipeline to stop.
- On success, responds with
StopPipelineOutput
with field(s):pipeline(Option<Pipeline>)
:Information about an existing OpenSearch Ingestion pipeline.
- On failure, responds with
SdkError<StopPipelineError>
Source§impl Client
impl Client
Sourcepub fn tag_resource(&self) -> TagResourceFluentBuilder
pub fn tag_resource(&self) -> TagResourceFluentBuilder
Constructs a fluent builder for the TagResource
operation.
- The fluent builder is configurable:
arn(impl Into<String>)
/set_arn(Option<String>)
:
required: trueThe Amazon Resource Name (ARN) of the pipeline to tag.
tags(Tag)
/set_tags(Option<Vec::<Tag>>)
:
required: trueThe list of key-value tags to add to the pipeline.
- On success, responds with
TagResourceOutput
- On failure, responds with
SdkError<TagResourceError>
Source§impl Client
impl Client
Sourcepub fn untag_resource(&self) -> UntagResourceFluentBuilder
pub fn untag_resource(&self) -> UntagResourceFluentBuilder
Constructs a fluent builder for the UntagResource
operation.
- The fluent builder is configurable:
arn(impl Into<String>)
/set_arn(Option<String>)
:
required: trueThe Amazon Resource Name (ARN) of the pipeline to remove tags from.
tag_keys(impl Into<String>)
/set_tag_keys(Option<Vec::<String>>)
:
required: trueThe tag keys to remove.
- On success, responds with
UntagResourceOutput
- On failure, responds with
SdkError<UntagResourceError>
Source§impl Client
impl Client
Sourcepub fn update_pipeline(&self) -> UpdatePipelineFluentBuilder
pub fn update_pipeline(&self) -> UpdatePipelineFluentBuilder
Constructs a fluent builder for the UpdatePipeline
operation.
- The fluent builder is configurable:
pipeline_name(impl Into<String>)
/set_pipeline_name(Option<String>)
:
required: trueThe name of the pipeline to update.
min_units(i32)
/set_min_units(Option<i32>)
:
required: falseThe minimum pipeline capacity, in Ingestion Compute Units (ICUs).
max_units(i32)
/set_max_units(Option<i32>)
:
required: falseThe maximum pipeline capacity, in Ingestion Compute Units (ICUs)
pipeline_configuration_body(impl Into<String>)
/set_pipeline_configuration_body(Option<String>)
:
required: falseThe pipeline configuration in YAML format. The command accepts the pipeline configuration as a string or within a .yaml file. If you provide the configuration as a string, each new line must be escaped with
\n
.log_publishing_options(LogPublishingOptions)
/set_log_publishing_options(Option<LogPublishingOptions>)
:
required: falseKey-value pairs to configure log publishing.
buffer_options(BufferOptions)
/set_buffer_options(Option<BufferOptions>)
:
required: falseKey-value pairs to configure persistent buffering for the pipeline.
encryption_at_rest_options(EncryptionAtRestOptions)
/set_encryption_at_rest_options(Option<EncryptionAtRestOptions>)
:
required: falseKey-value pairs to configure encryption for data that is written to a persistent buffer.
pipeline_role_arn(impl Into<String>)
/set_pipeline_role_arn(Option<String>)
:
required: falseThe Amazon Resource Name (ARN) of the IAM role that grants the pipeline permission to access Amazon Web Services resources.
- On success, responds with
UpdatePipelineOutput
with field(s):pipeline(Option<Pipeline>)
:Container for information about the updated pipeline.
- On failure, responds with
SdkError<UpdatePipelineError>
Source§impl Client
impl Client
Sourcepub fn validate_pipeline(&self) -> ValidatePipelineFluentBuilder
pub fn validate_pipeline(&self) -> ValidatePipelineFluentBuilder
Constructs a fluent builder for the ValidatePipeline
operation.
- The fluent builder is configurable:
pipeline_configuration_body(impl Into<String>)
/set_pipeline_configuration_body(Option<String>)
:
required: trueThe pipeline configuration in YAML format. The command accepts the pipeline configuration as a string or within a .yaml file. If you provide the configuration as a string, each new line must be escaped with
\n
.
- On success, responds with
ValidatePipelineOutput
with field(s):is_valid(Option<bool>)
:A boolean indicating whether or not the pipeline configuration is valid.
errors(Option<Vec::<ValidationMessage>>)
:A list of errors if the configuration is invalid.
- On failure, responds with
SdkError<ValidatePipelineError>
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);