Struct aws_sdk_dynamodb::operation::query::QueryInput
source · #[non_exhaustive]pub struct QueryInput {Show 17 fields
pub table_name: Option<String>,
pub index_name: Option<String>,
pub select: Option<Select>,
pub attributes_to_get: Option<Vec<String>>,
pub limit: Option<i32>,
pub consistent_read: Option<bool>,
pub key_conditions: Option<HashMap<String, Condition>>,
pub query_filter: Option<HashMap<String, Condition>>,
pub conditional_operator: Option<ConditionalOperator>,
pub scan_index_forward: Option<bool>,
pub exclusive_start_key: Option<HashMap<String, AttributeValue>>,
pub return_consumed_capacity: Option<ReturnConsumedCapacity>,
pub projection_expression: Option<String>,
pub filter_expression: Option<String>,
pub key_condition_expression: Option<String>,
pub expression_attribute_names: Option<HashMap<String, String>>,
pub expression_attribute_values: Option<HashMap<String, AttributeValue>>,
}
Expand description
Represents the input of a Query
operation.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. }
syntax; cannot be matched against without a wildcard ..
; and struct update syntax will not work.table_name: Option<String>
The name of the table containing the requested items. You can also provide the Amazon Resource Name (ARN) of the table in this parameter.
index_name: Option<String>
The name of an index to query. This index can be any local secondary index or global secondary index on the table. Note that if you use the IndexName
parameter, you must also provide TableName.
select: Option<Select>
The attributes to be returned in the result. You can retrieve all item attributes, specific item attributes, the count of matching items, or in the case of an index, some or all of the attributes projected into the index.
-
ALL_ATTRIBUTES
- Returns all of the item attributes from the specified table or index. If you query a local secondary index, then for each matching item in the index, DynamoDB fetches the entire item from the parent table. If the index is configured to project all item attributes, then all of the data can be obtained from the local secondary index, and no fetching is required. -
ALL_PROJECTED_ATTRIBUTES
- Allowed only when querying an index. Retrieves all attributes that have been projected into the index. If the index is configured to project all attributes, this return value is equivalent to specifyingALL_ATTRIBUTES
. -
COUNT
- Returns the number of matching items, rather than the matching items themselves. Note that this uses the same quantity of read capacity units as getting the items, and is subject to the same item size calculations. -
SPECIFIC_ATTRIBUTES
- Returns only the attributes listed inProjectionExpression
. This return value is equivalent to specifyingProjectionExpression
without specifying any value forSelect
.If you query or scan a local secondary index and request only attributes that are projected into that index, the operation will read only the index and not the table. If any of the requested attributes are not projected into the local secondary index, DynamoDB fetches each of these attributes from the parent table. This extra fetching incurs additional throughput cost and latency.
If you query or scan a global secondary index, you can only request attributes that are projected into the index. Global secondary index queries cannot fetch attributes from the parent table.
If neither Select
nor ProjectionExpression
are specified, DynamoDB defaults to ALL_ATTRIBUTES
when accessing a table, and ALL_PROJECTED_ATTRIBUTES
when accessing an index. You cannot use both Select
and ProjectionExpression
together in a single request, unless the value for Select
is SPECIFIC_ATTRIBUTES
. (This usage is equivalent to specifying ProjectionExpression
without any value for Select
.)
If you use the ProjectionExpression
parameter, then the value for Select
can only be SPECIFIC_ATTRIBUTES
. Any other value for Select
will return an error.
attributes_to_get: Option<Vec<String>>
This is a legacy parameter. Use ProjectionExpression
instead. For more information, see AttributesToGet in the Amazon DynamoDB Developer Guide.
limit: Option<i32>
The maximum number of items to evaluate (not necessarily the number of matching items). If DynamoDB processes the number of items up to the limit while processing the results, it stops the operation and returns the matching values up to that point, and a key in LastEvaluatedKey
to apply in a subsequent operation, so that you can pick up where you left off. Also, if the processed dataset size exceeds 1 MB before DynamoDB reaches this limit, it stops the operation and returns the matching values up to the limit, and a key in LastEvaluatedKey
to apply in a subsequent operation to continue the operation. For more information, see Query and Scan in the Amazon DynamoDB Developer Guide.
consistent_read: Option<bool>
Determines the read consistency model: If set to true
, then the operation uses strongly consistent reads; otherwise, the operation uses eventually consistent reads.
Strongly consistent reads are not supported on global secondary indexes. If you query a global secondary index with ConsistentRead
set to true
, you will receive a ValidationException
.
key_conditions: Option<HashMap<String, Condition>>
This is a legacy parameter. Use KeyConditionExpression
instead. For more information, see KeyConditions in the Amazon DynamoDB Developer Guide.
query_filter: Option<HashMap<String, Condition>>
This is a legacy parameter. Use FilterExpression
instead. For more information, see QueryFilter in the Amazon DynamoDB Developer Guide.
conditional_operator: Option<ConditionalOperator>
This is a legacy parameter. Use FilterExpression
instead. For more information, see ConditionalOperator in the Amazon DynamoDB Developer Guide.
scan_index_forward: Option<bool>
Specifies the order for index traversal: If true
(default), the traversal is performed in ascending order; if false
, the traversal is performed in descending order.
Items with the same partition key value are stored in sorted order by sort key. If the sort key data type is Number, the results are stored in numeric order. For type String, the results are stored in order of UTF-8 bytes. For type Binary, DynamoDB treats each byte of the binary data as unsigned.
If ScanIndexForward
is true
, DynamoDB returns the results in the order in which they are stored (by sort key value). This is the default behavior. If ScanIndexForward
is false
, DynamoDB reads the results in reverse order by sort key value, and then returns the results to the client.
exclusive_start_key: Option<HashMap<String, AttributeValue>>
The primary key of the first item that this operation will evaluate. Use the value that was returned for LastEvaluatedKey
in the previous operation.
The data type for ExclusiveStartKey
must be String, Number, or Binary. No set data types are allowed.
return_consumed_capacity: Option<ReturnConsumedCapacity>
Determines the level of detail about either provisioned or on-demand throughput consumption that is returned in the response:
-
INDEXES
- The response includes the aggregateConsumedCapacity
for the operation, together withConsumedCapacity
for each table and secondary index that was accessed.Note that some operations, such as
GetItem
andBatchGetItem
, do not access any indexes at all. In these cases, specifyingINDEXES
will only returnConsumedCapacity
information for table(s). -
TOTAL
- The response includes only the aggregateConsumedCapacity
for the operation. -
NONE
- NoConsumedCapacity
details are included in the response.
projection_expression: Option<String>
A string that identifies one or more attributes to retrieve from the table. These attributes can include scalars, sets, or elements of a JSON document. The attributes in the expression must be separated by commas.
If no attribute names are specified, then all attributes will be returned. If any of the requested attributes are not found, they will not appear in the result.
For more information, see Accessing Item Attributes in the Amazon DynamoDB Developer Guide.
filter_expression: Option<String>
A string that contains conditions that DynamoDB applies after the Query
operation, but before the data is returned to you. Items that do not satisfy the FilterExpression
criteria are not returned.
A FilterExpression
does not allow key attributes. You cannot define a filter expression based on a partition key or a sort key.
A FilterExpression
is applied after the items have already been read; the process of filtering does not consume any additional read capacity units.
For more information, see Filter Expressions in the Amazon DynamoDB Developer Guide.
key_condition_expression: Option<String>
The condition that specifies the key values for items to be retrieved by the Query
action.
The condition must perform an equality test on a single partition key value.
The condition can optionally perform one of several comparison tests on a single sort key value. This allows Query
to retrieve one item with a given partition key value and sort key value, or several items that have the same partition key value but different sort key values.
The partition key equality test is required, and must be specified in the following format:
partitionKeyName
= :partitionkeyval
If you also want to provide a condition for the sort key, it must be combined using AND
with the condition for the sort key. Following is an example, using the = comparison operator for the sort key:
partitionKeyName
=
:partitionkeyval
AND
sortKeyName
=
:sortkeyval
Valid comparisons for the sort key condition are as follows:
-
sortKeyName
=
:sortkeyval
- true if the sort key value is equal to:sortkeyval
. -
sortKeyName
<
:sortkeyval
- true if the sort key value is less than:sortkeyval
. -
sortKeyName
<=
:sortkeyval
- true if the sort key value is less than or equal to:sortkeyval
. -
sortKeyName
>
:sortkeyval
- true if the sort key value is greater than:sortkeyval
. -
sortKeyName
>=
:sortkeyval
- true if the sort key value is greater than or equal to:sortkeyval
. -
sortKeyName
BETWEEN
:sortkeyval1
AND
:sortkeyval2
- true if the sort key value is greater than or equal to:sortkeyval1
, and less than or equal to:sortkeyval2
. -
begins_with (
sortKeyName
,:sortkeyval
)
- true if the sort key value begins with a particular operand. (You cannot use this function with a sort key that is of type Number.) Note that the function namebegins_with
is case-sensitive.
Use the ExpressionAttributeValues
parameter to replace tokens such as :partitionval
and :sortval
with actual values at runtime.
You can optionally use the ExpressionAttributeNames
parameter to replace the names of the partition key and sort key with placeholder tokens. This option might be necessary if an attribute name conflicts with a DynamoDB reserved word. For example, the following KeyConditionExpression
parameter causes an error because Size is a reserved word:
-
Size = :myval
To work around this, define a placeholder (such a #S
) to represent the attribute name Size. KeyConditionExpression
then is as follows:
-
#S = :myval
For a list of reserved words, see Reserved Words in the Amazon DynamoDB Developer Guide.
For more information on ExpressionAttributeNames
and ExpressionAttributeValues
, see Using Placeholders for Attribute Names and Values in the Amazon DynamoDB Developer Guide.
expression_attribute_names: Option<HashMap<String, String>>
One or more substitution tokens for attribute names in an expression. The following are some use cases for using ExpressionAttributeNames
:
-
To access an attribute whose name conflicts with a DynamoDB reserved word.
-
To create a placeholder for repeating occurrences of an attribute name in an expression.
-
To prevent special characters in an attribute name from being misinterpreted in an expression.
Use the # character in an expression to dereference an attribute name. For example, consider the following attribute name:
-
Percentile
The name of this attribute conflicts with a reserved word, so it cannot be used directly in an expression. (For the complete list of reserved words, see Reserved Words in the Amazon DynamoDB Developer Guide). To work around this, you could specify the following for ExpressionAttributeNames
:
-
{"#P":"Percentile"}
You could then use this substitution in an expression, as in this example:
-
#P = :val
Tokens that begin with the : character are expression attribute values, which are placeholders for the actual value at runtime.
For more information on expression attribute names, see Specifying Item Attributes in the Amazon DynamoDB Developer Guide.
expression_attribute_values: Option<HashMap<String, AttributeValue>>
One or more values that can be substituted in an expression.
Use the : (colon) character in an expression to dereference an attribute value. For example, suppose that you wanted to check whether the value of the ProductStatus attribute was one of the following:
Available | Backordered | Discontinued
You would first need to specify ExpressionAttributeValues
as follows:
{ ":avail":{"S":"Available"}, ":back":{"S":"Backordered"}, ":disc":{"S":"Discontinued"} }
You could then use these values in an expression, such as this:
ProductStatus IN (:avail, :back, :disc)
For more information on expression attribute values, see Specifying Conditions in the Amazon DynamoDB Developer Guide.
Implementations§
source§impl QueryInput
impl QueryInput
sourcepub fn table_name(&self) -> Option<&str>
pub fn table_name(&self) -> Option<&str>
The name of the table containing the requested items. You can also provide the Amazon Resource Name (ARN) of the table in this parameter.
sourcepub fn index_name(&self) -> Option<&str>
pub fn index_name(&self) -> Option<&str>
The name of an index to query. This index can be any local secondary index or global secondary index on the table. Note that if you use the IndexName
parameter, you must also provide TableName.
sourcepub fn select(&self) -> Option<&Select>
pub fn select(&self) -> Option<&Select>
The attributes to be returned in the result. You can retrieve all item attributes, specific item attributes, the count of matching items, or in the case of an index, some or all of the attributes projected into the index.
-
ALL_ATTRIBUTES
- Returns all of the item attributes from the specified table or index. If you query a local secondary index, then for each matching item in the index, DynamoDB fetches the entire item from the parent table. If the index is configured to project all item attributes, then all of the data can be obtained from the local secondary index, and no fetching is required. -
ALL_PROJECTED_ATTRIBUTES
- Allowed only when querying an index. Retrieves all attributes that have been projected into the index. If the index is configured to project all attributes, this return value is equivalent to specifyingALL_ATTRIBUTES
. -
COUNT
- Returns the number of matching items, rather than the matching items themselves. Note that this uses the same quantity of read capacity units as getting the items, and is subject to the same item size calculations. -
SPECIFIC_ATTRIBUTES
- Returns only the attributes listed inProjectionExpression
. This return value is equivalent to specifyingProjectionExpression
without specifying any value forSelect
.If you query or scan a local secondary index and request only attributes that are projected into that index, the operation will read only the index and not the table. If any of the requested attributes are not projected into the local secondary index, DynamoDB fetches each of these attributes from the parent table. This extra fetching incurs additional throughput cost and latency.
If you query or scan a global secondary index, you can only request attributes that are projected into the index. Global secondary index queries cannot fetch attributes from the parent table.
If neither Select
nor ProjectionExpression
are specified, DynamoDB defaults to ALL_ATTRIBUTES
when accessing a table, and ALL_PROJECTED_ATTRIBUTES
when accessing an index. You cannot use both Select
and ProjectionExpression
together in a single request, unless the value for Select
is SPECIFIC_ATTRIBUTES
. (This usage is equivalent to specifying ProjectionExpression
without any value for Select
.)
If you use the ProjectionExpression
parameter, then the value for Select
can only be SPECIFIC_ATTRIBUTES
. Any other value for Select
will return an error.
sourcepub fn attributes_to_get(&self) -> &[String]
pub fn attributes_to_get(&self) -> &[String]
This is a legacy parameter. Use ProjectionExpression
instead. For more information, see AttributesToGet in the Amazon DynamoDB Developer Guide.
If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use .attributes_to_get.is_none()
.
sourcepub fn limit(&self) -> Option<i32>
pub fn limit(&self) -> Option<i32>
The maximum number of items to evaluate (not necessarily the number of matching items). If DynamoDB processes the number of items up to the limit while processing the results, it stops the operation and returns the matching values up to that point, and a key in LastEvaluatedKey
to apply in a subsequent operation, so that you can pick up where you left off. Also, if the processed dataset size exceeds 1 MB before DynamoDB reaches this limit, it stops the operation and returns the matching values up to the limit, and a key in LastEvaluatedKey
to apply in a subsequent operation to continue the operation. For more information, see Query and Scan in the Amazon DynamoDB Developer Guide.
sourcepub fn consistent_read(&self) -> Option<bool>
pub fn consistent_read(&self) -> Option<bool>
Determines the read consistency model: If set to true
, then the operation uses strongly consistent reads; otherwise, the operation uses eventually consistent reads.
Strongly consistent reads are not supported on global secondary indexes. If you query a global secondary index with ConsistentRead
set to true
, you will receive a ValidationException
.
sourcepub fn key_conditions(&self) -> Option<&HashMap<String, Condition>>
pub fn key_conditions(&self) -> Option<&HashMap<String, Condition>>
This is a legacy parameter. Use KeyConditionExpression
instead. For more information, see KeyConditions in the Amazon DynamoDB Developer Guide.
sourcepub fn query_filter(&self) -> Option<&HashMap<String, Condition>>
pub fn query_filter(&self) -> Option<&HashMap<String, Condition>>
This is a legacy parameter. Use FilterExpression
instead. For more information, see QueryFilter in the Amazon DynamoDB Developer Guide.
sourcepub fn conditional_operator(&self) -> Option<&ConditionalOperator>
pub fn conditional_operator(&self) -> Option<&ConditionalOperator>
This is a legacy parameter. Use FilterExpression
instead. For more information, see ConditionalOperator in the Amazon DynamoDB Developer Guide.
sourcepub fn scan_index_forward(&self) -> Option<bool>
pub fn scan_index_forward(&self) -> Option<bool>
Specifies the order for index traversal: If true
(default), the traversal is performed in ascending order; if false
, the traversal is performed in descending order.
Items with the same partition key value are stored in sorted order by sort key. If the sort key data type is Number, the results are stored in numeric order. For type String, the results are stored in order of UTF-8 bytes. For type Binary, DynamoDB treats each byte of the binary data as unsigned.
If ScanIndexForward
is true
, DynamoDB returns the results in the order in which they are stored (by sort key value). This is the default behavior. If ScanIndexForward
is false
, DynamoDB reads the results in reverse order by sort key value, and then returns the results to the client.
sourcepub fn exclusive_start_key(&self) -> Option<&HashMap<String, AttributeValue>>
pub fn exclusive_start_key(&self) -> Option<&HashMap<String, AttributeValue>>
The primary key of the first item that this operation will evaluate. Use the value that was returned for LastEvaluatedKey
in the previous operation.
The data type for ExclusiveStartKey
must be String, Number, or Binary. No set data types are allowed.
sourcepub fn return_consumed_capacity(&self) -> Option<&ReturnConsumedCapacity>
pub fn return_consumed_capacity(&self) -> Option<&ReturnConsumedCapacity>
Determines the level of detail about either provisioned or on-demand throughput consumption that is returned in the response:
-
INDEXES
- The response includes the aggregateConsumedCapacity
for the operation, together withConsumedCapacity
for each table and secondary index that was accessed.Note that some operations, such as
GetItem
andBatchGetItem
, do not access any indexes at all. In these cases, specifyingINDEXES
will only returnConsumedCapacity
information for table(s). -
TOTAL
- The response includes only the aggregateConsumedCapacity
for the operation. -
NONE
- NoConsumedCapacity
details are included in the response.
sourcepub fn projection_expression(&self) -> Option<&str>
pub fn projection_expression(&self) -> Option<&str>
A string that identifies one or more attributes to retrieve from the table. These attributes can include scalars, sets, or elements of a JSON document. The attributes in the expression must be separated by commas.
If no attribute names are specified, then all attributes will be returned. If any of the requested attributes are not found, they will not appear in the result.
For more information, see Accessing Item Attributes in the Amazon DynamoDB Developer Guide.
sourcepub fn filter_expression(&self) -> Option<&str>
pub fn filter_expression(&self) -> Option<&str>
A string that contains conditions that DynamoDB applies after the Query
operation, but before the data is returned to you. Items that do not satisfy the FilterExpression
criteria are not returned.
A FilterExpression
does not allow key attributes. You cannot define a filter expression based on a partition key or a sort key.
A FilterExpression
is applied after the items have already been read; the process of filtering does not consume any additional read capacity units.
For more information, see Filter Expressions in the Amazon DynamoDB Developer Guide.
sourcepub fn key_condition_expression(&self) -> Option<&str>
pub fn key_condition_expression(&self) -> Option<&str>
The condition that specifies the key values for items to be retrieved by the Query
action.
The condition must perform an equality test on a single partition key value.
The condition can optionally perform one of several comparison tests on a single sort key value. This allows Query
to retrieve one item with a given partition key value and sort key value, or several items that have the same partition key value but different sort key values.
The partition key equality test is required, and must be specified in the following format:
partitionKeyName
= :partitionkeyval
If you also want to provide a condition for the sort key, it must be combined using AND
with the condition for the sort key. Following is an example, using the = comparison operator for the sort key:
partitionKeyName
=
:partitionkeyval
AND
sortKeyName
=
:sortkeyval
Valid comparisons for the sort key condition are as follows:
-
sortKeyName
=
:sortkeyval
- true if the sort key value is equal to:sortkeyval
. -
sortKeyName
<
:sortkeyval
- true if the sort key value is less than:sortkeyval
. -
sortKeyName
<=
:sortkeyval
- true if the sort key value is less than or equal to:sortkeyval
. -
sortKeyName
>
:sortkeyval
- true if the sort key value is greater than:sortkeyval
. -
sortKeyName
>=
:sortkeyval
- true if the sort key value is greater than or equal to:sortkeyval
. -
sortKeyName
BETWEEN
:sortkeyval1
AND
:sortkeyval2
- true if the sort key value is greater than or equal to:sortkeyval1
, and less than or equal to:sortkeyval2
. -
begins_with (
sortKeyName
,:sortkeyval
)
- true if the sort key value begins with a particular operand. (You cannot use this function with a sort key that is of type Number.) Note that the function namebegins_with
is case-sensitive.
Use the ExpressionAttributeValues
parameter to replace tokens such as :partitionval
and :sortval
with actual values at runtime.
You can optionally use the ExpressionAttributeNames
parameter to replace the names of the partition key and sort key with placeholder tokens. This option might be necessary if an attribute name conflicts with a DynamoDB reserved word. For example, the following KeyConditionExpression
parameter causes an error because Size is a reserved word:
-
Size = :myval
To work around this, define a placeholder (such a #S
) to represent the attribute name Size. KeyConditionExpression
then is as follows:
-
#S = :myval
For a list of reserved words, see Reserved Words in the Amazon DynamoDB Developer Guide.
For more information on ExpressionAttributeNames
and ExpressionAttributeValues
, see Using Placeholders for Attribute Names and Values in the Amazon DynamoDB Developer Guide.
sourcepub fn expression_attribute_names(&self) -> Option<&HashMap<String, String>>
pub fn expression_attribute_names(&self) -> Option<&HashMap<String, String>>
One or more substitution tokens for attribute names in an expression. The following are some use cases for using ExpressionAttributeNames
:
-
To access an attribute whose name conflicts with a DynamoDB reserved word.
-
To create a placeholder for repeating occurrences of an attribute name in an expression.
-
To prevent special characters in an attribute name from being misinterpreted in an expression.
Use the # character in an expression to dereference an attribute name. For example, consider the following attribute name:
-
Percentile
The name of this attribute conflicts with a reserved word, so it cannot be used directly in an expression. (For the complete list of reserved words, see Reserved Words in the Amazon DynamoDB Developer Guide). To work around this, you could specify the following for ExpressionAttributeNames
:
-
{"#P":"Percentile"}
You could then use this substitution in an expression, as in this example:
-
#P = :val
Tokens that begin with the : character are expression attribute values, which are placeholders for the actual value at runtime.
For more information on expression attribute names, see Specifying Item Attributes in the Amazon DynamoDB Developer Guide.
sourcepub fn expression_attribute_values(
&self,
) -> Option<&HashMap<String, AttributeValue>>
pub fn expression_attribute_values( &self, ) -> Option<&HashMap<String, AttributeValue>>
One or more values that can be substituted in an expression.
Use the : (colon) character in an expression to dereference an attribute value. For example, suppose that you wanted to check whether the value of the ProductStatus attribute was one of the following:
Available | Backordered | Discontinued
You would first need to specify ExpressionAttributeValues
as follows:
{ ":avail":{"S":"Available"}, ":back":{"S":"Backordered"}, ":disc":{"S":"Discontinued"} }
You could then use these values in an expression, such as this:
ProductStatus IN (:avail, :back, :disc)
For more information on expression attribute values, see Specifying Conditions in the Amazon DynamoDB Developer Guide.
source§impl QueryInput
impl QueryInput
sourcepub fn builder() -> QueryInputBuilder
pub fn builder() -> QueryInputBuilder
Creates a new builder-style object to manufacture QueryInput
.
Trait Implementations§
source§impl Clone for QueryInput
impl Clone for QueryInput
source§fn clone(&self) -> QueryInput
fn clone(&self) -> QueryInput
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for QueryInput
impl Debug for QueryInput
source§impl PartialEq for QueryInput
impl PartialEq for QueryInput
source§fn eq(&self, other: &QueryInput) -> bool
fn eq(&self, other: &QueryInput) -> bool
self
and other
values to be equal, and is used
by ==
.impl StructuralPartialEq for QueryInput
Auto Trait Implementations§
impl Freeze for QueryInput
impl RefUnwindSafe for QueryInput
impl Send for QueryInput
impl Sync for QueryInput
impl Unpin for QueryInput
impl UnwindSafe for QueryInput
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§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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 more§impl<T> Paint for Twhere
T: ?Sized,
impl<T> Paint for Twhere
T: ?Sized,
§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();
§fn bright_black(&self) -> Painted<&T>
fn bright_black(&self) -> Painted<&T>
§fn bright_red(&self) -> Painted<&T>
fn bright_red(&self) -> Painted<&T>
§fn bright_green(&self) -> Painted<&T>
fn bright_green(&self) -> Painted<&T>
§fn bright_yellow(&self) -> Painted<&T>
fn bright_yellow(&self) -> Painted<&T>
§fn bright_blue(&self) -> Painted<&T>
fn bright_blue(&self) -> Painted<&T>
§fn bright_magenta(&self) -> Painted<&T>
fn bright_magenta(&self) -> Painted<&T>
§fn bright_cyan(&self) -> Painted<&T>
fn bright_cyan(&self) -> Painted<&T>
§fn bright_white(&self) -> Painted<&T>
fn bright_white(&self) -> Painted<&T>
§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();
§fn on_primary(&self) -> Painted<&T>
fn on_primary(&self) -> Painted<&T>
§fn on_magenta(&self) -> Painted<&T>
fn on_magenta(&self) -> Painted<&T>
§fn on_bright_black(&self) -> Painted<&T>
fn on_bright_black(&self) -> Painted<&T>
§fn on_bright_red(&self) -> Painted<&T>
fn on_bright_red(&self) -> Painted<&T>
§fn on_bright_green(&self) -> Painted<&T>
fn on_bright_green(&self) -> Painted<&T>
§fn on_bright_yellow(&self) -> Painted<&T>
fn on_bright_yellow(&self) -> Painted<&T>
§fn on_bright_blue(&self) -> Painted<&T>
fn on_bright_blue(&self) -> Painted<&T>
§fn on_bright_magenta(&self) -> Painted<&T>
fn on_bright_magenta(&self) -> Painted<&T>
§fn on_bright_cyan(&self) -> Painted<&T>
fn on_bright_cyan(&self) -> Painted<&T>
§fn on_bright_white(&self) -> Painted<&T>
fn on_bright_white(&self) -> Painted<&T>
§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();
§fn rapid_blink(&self) -> Painted<&T>
fn rapid_blink(&self) -> Painted<&T>
§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();
§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.§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);