#[non_exhaustive]pub struct PolicyBuilder { /* private fields */ }
Expand description
A builder for Policy
.
Implementations§
Source§impl PolicyBuilder
impl PolicyBuilder
Sourcepub fn policy_id(self, input: impl Into<String>) -> Self
pub fn policy_id(self, input: impl Into<String>) -> Self
The ID of the Firewall Manager policy.
Sourcepub fn set_policy_id(self, input: Option<String>) -> Self
pub fn set_policy_id(self, input: Option<String>) -> Self
The ID of the Firewall Manager policy.
Sourcepub fn get_policy_id(&self) -> &Option<String>
pub fn get_policy_id(&self) -> &Option<String>
The ID of the Firewall Manager policy.
Sourcepub fn policy_name(self, input: impl Into<String>) -> Self
pub fn policy_name(self, input: impl Into<String>) -> Self
The name of the Firewall Manager policy.
This field is required.Sourcepub fn set_policy_name(self, input: Option<String>) -> Self
pub fn set_policy_name(self, input: Option<String>) -> Self
The name of the Firewall Manager policy.
Sourcepub fn get_policy_name(&self) -> &Option<String>
pub fn get_policy_name(&self) -> &Option<String>
The name of the Firewall Manager policy.
Sourcepub fn policy_update_token(self, input: impl Into<String>) -> Self
pub fn policy_update_token(self, input: impl Into<String>) -> Self
A unique identifier for each update to the policy. When issuing a PutPolicy
request, the PolicyUpdateToken
in the request must match the PolicyUpdateToken
of the current policy version. To get the PolicyUpdateToken
of the current policy version, use a GetPolicy
request.
Sourcepub fn set_policy_update_token(self, input: Option<String>) -> Self
pub fn set_policy_update_token(self, input: Option<String>) -> Self
A unique identifier for each update to the policy. When issuing a PutPolicy
request, the PolicyUpdateToken
in the request must match the PolicyUpdateToken
of the current policy version. To get the PolicyUpdateToken
of the current policy version, use a GetPolicy
request.
Sourcepub fn get_policy_update_token(&self) -> &Option<String>
pub fn get_policy_update_token(&self) -> &Option<String>
A unique identifier for each update to the policy. When issuing a PutPolicy
request, the PolicyUpdateToken
in the request must match the PolicyUpdateToken
of the current policy version. To get the PolicyUpdateToken
of the current policy version, use a GetPolicy
request.
Sourcepub fn security_service_policy_data(
self,
input: SecurityServicePolicyData,
) -> Self
pub fn security_service_policy_data( self, input: SecurityServicePolicyData, ) -> Self
Details about the security service that is being used to protect the resources.
This field is required.Sourcepub fn set_security_service_policy_data(
self,
input: Option<SecurityServicePolicyData>,
) -> Self
pub fn set_security_service_policy_data( self, input: Option<SecurityServicePolicyData>, ) -> Self
Details about the security service that is being used to protect the resources.
Sourcepub fn get_security_service_policy_data(
&self,
) -> &Option<SecurityServicePolicyData>
pub fn get_security_service_policy_data( &self, ) -> &Option<SecurityServicePolicyData>
Details about the security service that is being used to protect the resources.
Sourcepub fn resource_type(self, input: impl Into<String>) -> Self
pub fn resource_type(self, input: impl Into<String>) -> Self
The type of resource protected by or in scope of the policy. This is in the format shown in the Amazon Web Services Resource Types Reference. To apply this policy to multiple resource types, specify a resource type of ResourceTypeList
and then specify the resource types in a ResourceTypeList
.
The following are valid resource types for each Firewall Manager policy type:
-
Amazon Web Services WAF Classic -
AWS::ApiGateway::Stage
,AWS::CloudFront::Distribution
, andAWS::ElasticLoadBalancingV2::LoadBalancer
. -
WAF -
AWS::ApiGateway::Stage
,AWS::ElasticLoadBalancingV2::LoadBalancer
, andAWS::CloudFront::Distribution
. -
Shield Advanced -
AWS::ElasticLoadBalancingV2::LoadBalancer
,AWS::ElasticLoadBalancing::LoadBalancer
,AWS::EC2::EIP
, andAWS::CloudFront::Distribution
. -
Network ACL -
AWS::EC2::Subnet
. -
Security group usage audit -
AWS::EC2::SecurityGroup
. -
Security group content audit -
AWS::EC2::SecurityGroup
,AWS::EC2::NetworkInterface
, andAWS::EC2::Instance
. -
DNS Firewall, Network Firewall, and third-party firewall -
AWS::EC2::VPC
.
Sourcepub fn set_resource_type(self, input: Option<String>) -> Self
pub fn set_resource_type(self, input: Option<String>) -> Self
The type of resource protected by or in scope of the policy. This is in the format shown in the Amazon Web Services Resource Types Reference. To apply this policy to multiple resource types, specify a resource type of ResourceTypeList
and then specify the resource types in a ResourceTypeList
.
The following are valid resource types for each Firewall Manager policy type:
-
Amazon Web Services WAF Classic -
AWS::ApiGateway::Stage
,AWS::CloudFront::Distribution
, andAWS::ElasticLoadBalancingV2::LoadBalancer
. -
WAF -
AWS::ApiGateway::Stage
,AWS::ElasticLoadBalancingV2::LoadBalancer
, andAWS::CloudFront::Distribution
. -
Shield Advanced -
AWS::ElasticLoadBalancingV2::LoadBalancer
,AWS::ElasticLoadBalancing::LoadBalancer
,AWS::EC2::EIP
, andAWS::CloudFront::Distribution
. -
Network ACL -
AWS::EC2::Subnet
. -
Security group usage audit -
AWS::EC2::SecurityGroup
. -
Security group content audit -
AWS::EC2::SecurityGroup
,AWS::EC2::NetworkInterface
, andAWS::EC2::Instance
. -
DNS Firewall, Network Firewall, and third-party firewall -
AWS::EC2::VPC
.
Sourcepub fn get_resource_type(&self) -> &Option<String>
pub fn get_resource_type(&self) -> &Option<String>
The type of resource protected by or in scope of the policy. This is in the format shown in the Amazon Web Services Resource Types Reference. To apply this policy to multiple resource types, specify a resource type of ResourceTypeList
and then specify the resource types in a ResourceTypeList
.
The following are valid resource types for each Firewall Manager policy type:
-
Amazon Web Services WAF Classic -
AWS::ApiGateway::Stage
,AWS::CloudFront::Distribution
, andAWS::ElasticLoadBalancingV2::LoadBalancer
. -
WAF -
AWS::ApiGateway::Stage
,AWS::ElasticLoadBalancingV2::LoadBalancer
, andAWS::CloudFront::Distribution
. -
Shield Advanced -
AWS::ElasticLoadBalancingV2::LoadBalancer
,AWS::ElasticLoadBalancing::LoadBalancer
,AWS::EC2::EIP
, andAWS::CloudFront::Distribution
. -
Network ACL -
AWS::EC2::Subnet
. -
Security group usage audit -
AWS::EC2::SecurityGroup
. -
Security group content audit -
AWS::EC2::SecurityGroup
,AWS::EC2::NetworkInterface
, andAWS::EC2::Instance
. -
DNS Firewall, Network Firewall, and third-party firewall -
AWS::EC2::VPC
.
Sourcepub fn resource_type_list(self, input: impl Into<String>) -> Self
pub fn resource_type_list(self, input: impl Into<String>) -> Self
Appends an item to resource_type_list
.
To override the contents of this collection use set_resource_type_list
.
An array of ResourceType
objects. Use this only to specify multiple resource types. To specify a single resource type, use ResourceType
.
Sourcepub fn set_resource_type_list(self, input: Option<Vec<String>>) -> Self
pub fn set_resource_type_list(self, input: Option<Vec<String>>) -> Self
An array of ResourceType
objects. Use this only to specify multiple resource types. To specify a single resource type, use ResourceType
.
Sourcepub fn get_resource_type_list(&self) -> &Option<Vec<String>>
pub fn get_resource_type_list(&self) -> &Option<Vec<String>>
An array of ResourceType
objects. Use this only to specify multiple resource types. To specify a single resource type, use ResourceType
.
Appends an item to resource_tags
.
To override the contents of this collection use set_resource_tags
.
An array of ResourceTag
objects.
An array of ResourceTag
objects.
An array of ResourceTag
objects.
If set to True
, resources with the tags that are specified in the ResourceTag
array are not in scope of the policy. If set to False
, and the ResourceTag
array is not null, only resources with the specified tags are in scope of the policy.
If set to True
, resources with the tags that are specified in the ResourceTag
array are not in scope of the policy. If set to False
, and the ResourceTag
array is not null, only resources with the specified tags are in scope of the policy.
If set to True
, resources with the tags that are specified in the ResourceTag
array are not in scope of the policy. If set to False
, and the ResourceTag
array is not null, only resources with the specified tags are in scope of the policy.
Sourcepub fn remediation_enabled(self, input: bool) -> Self
pub fn remediation_enabled(self, input: bool) -> Self
Indicates if the policy should be automatically applied to new resources.
This field is required.Sourcepub fn set_remediation_enabled(self, input: Option<bool>) -> Self
pub fn set_remediation_enabled(self, input: Option<bool>) -> Self
Indicates if the policy should be automatically applied to new resources.
Sourcepub fn get_remediation_enabled(&self) -> &Option<bool>
pub fn get_remediation_enabled(&self) -> &Option<bool>
Indicates if the policy should be automatically applied to new resources.
Sourcepub fn delete_unused_fm_managed_resources(self, input: bool) -> Self
pub fn delete_unused_fm_managed_resources(self, input: bool) -> Self
Indicates whether Firewall Manager should automatically remove protections from resources that leave the policy scope and clean up resources that Firewall Manager is managing for accounts when those accounts leave policy scope. For example, Firewall Manager will disassociate a Firewall Manager managed web ACL from a protected customer resource when the customer resource leaves policy scope.
By default, Firewall Manager doesn't remove protections or delete Firewall Manager managed resources.
This option is not available for Shield Advanced or WAF Classic policies.
Sourcepub fn set_delete_unused_fm_managed_resources(self, input: Option<bool>) -> Self
pub fn set_delete_unused_fm_managed_resources(self, input: Option<bool>) -> Self
Indicates whether Firewall Manager should automatically remove protections from resources that leave the policy scope and clean up resources that Firewall Manager is managing for accounts when those accounts leave policy scope. For example, Firewall Manager will disassociate a Firewall Manager managed web ACL from a protected customer resource when the customer resource leaves policy scope.
By default, Firewall Manager doesn't remove protections or delete Firewall Manager managed resources.
This option is not available for Shield Advanced or WAF Classic policies.
Sourcepub fn get_delete_unused_fm_managed_resources(&self) -> &Option<bool>
pub fn get_delete_unused_fm_managed_resources(&self) -> &Option<bool>
Indicates whether Firewall Manager should automatically remove protections from resources that leave the policy scope and clean up resources that Firewall Manager is managing for accounts when those accounts leave policy scope. For example, Firewall Manager will disassociate a Firewall Manager managed web ACL from a protected customer resource when the customer resource leaves policy scope.
By default, Firewall Manager doesn't remove protections or delete Firewall Manager managed resources.
This option is not available for Shield Advanced or WAF Classic policies.
Sourcepub fn include_map(self, k: CustomerPolicyScopeIdType, v: Vec<String>) -> Self
pub fn include_map(self, k: CustomerPolicyScopeIdType, v: Vec<String>) -> Self
Adds a key-value pair to include_map
.
To override the contents of this collection use set_include_map
.
Specifies the Amazon Web Services account IDs and Organizations organizational units (OUs) to include in the policy. Specifying an OU is the equivalent of specifying all accounts in the OU and in any of its child OUs, including any child OUs and accounts that are added at a later time.
You can specify inclusions or exclusions, but not both. If you specify an IncludeMap
, Firewall Manager applies the policy to all accounts specified by the IncludeMap
, and does not evaluate any ExcludeMap
specifications. If you do not specify an IncludeMap
, then Firewall Manager applies the policy to all accounts except for those specified by the ExcludeMap
.
You can specify account IDs, OUs, or a combination:
-
Specify account IDs by setting the key to
ACCOUNT
. For example, the following is a valid map:{“ACCOUNT” : \[“accountID1”, “accountID2”\]}
. -
Specify OUs by setting the key to
ORG_UNIT
. For example, the following is a valid map:{“ORG_UNIT” : \[“ouid111”, “ouid112”\]}
. -
Specify accounts and OUs together in a single map, separated with a comma. For example, the following is a valid map:
{“ACCOUNT” : \[“accountID1”, “accountID2”\], “ORG_UNIT” : \[“ouid111”, “ouid112”\]}
.
Sourcepub fn set_include_map(
self,
input: Option<HashMap<CustomerPolicyScopeIdType, Vec<String>>>,
) -> Self
pub fn set_include_map( self, input: Option<HashMap<CustomerPolicyScopeIdType, Vec<String>>>, ) -> Self
Specifies the Amazon Web Services account IDs and Organizations organizational units (OUs) to include in the policy. Specifying an OU is the equivalent of specifying all accounts in the OU and in any of its child OUs, including any child OUs and accounts that are added at a later time.
You can specify inclusions or exclusions, but not both. If you specify an IncludeMap
, Firewall Manager applies the policy to all accounts specified by the IncludeMap
, and does not evaluate any ExcludeMap
specifications. If you do not specify an IncludeMap
, then Firewall Manager applies the policy to all accounts except for those specified by the ExcludeMap
.
You can specify account IDs, OUs, or a combination:
-
Specify account IDs by setting the key to
ACCOUNT
. For example, the following is a valid map:{“ACCOUNT” : \[“accountID1”, “accountID2”\]}
. -
Specify OUs by setting the key to
ORG_UNIT
. For example, the following is a valid map:{“ORG_UNIT” : \[“ouid111”, “ouid112”\]}
. -
Specify accounts and OUs together in a single map, separated with a comma. For example, the following is a valid map:
{“ACCOUNT” : \[“accountID1”, “accountID2”\], “ORG_UNIT” : \[“ouid111”, “ouid112”\]}
.
Sourcepub fn get_include_map(
&self,
) -> &Option<HashMap<CustomerPolicyScopeIdType, Vec<String>>>
pub fn get_include_map( &self, ) -> &Option<HashMap<CustomerPolicyScopeIdType, Vec<String>>>
Specifies the Amazon Web Services account IDs and Organizations organizational units (OUs) to include in the policy. Specifying an OU is the equivalent of specifying all accounts in the OU and in any of its child OUs, including any child OUs and accounts that are added at a later time.
You can specify inclusions or exclusions, but not both. If you specify an IncludeMap
, Firewall Manager applies the policy to all accounts specified by the IncludeMap
, and does not evaluate any ExcludeMap
specifications. If you do not specify an IncludeMap
, then Firewall Manager applies the policy to all accounts except for those specified by the ExcludeMap
.
You can specify account IDs, OUs, or a combination:
-
Specify account IDs by setting the key to
ACCOUNT
. For example, the following is a valid map:{“ACCOUNT” : \[“accountID1”, “accountID2”\]}
. -
Specify OUs by setting the key to
ORG_UNIT
. For example, the following is a valid map:{“ORG_UNIT” : \[“ouid111”, “ouid112”\]}
. -
Specify accounts and OUs together in a single map, separated with a comma. For example, the following is a valid map:
{“ACCOUNT” : \[“accountID1”, “accountID2”\], “ORG_UNIT” : \[“ouid111”, “ouid112”\]}
.
Sourcepub fn exclude_map(self, k: CustomerPolicyScopeIdType, v: Vec<String>) -> Self
pub fn exclude_map(self, k: CustomerPolicyScopeIdType, v: Vec<String>) -> Self
Adds a key-value pair to exclude_map
.
To override the contents of this collection use set_exclude_map
.
Specifies the Amazon Web Services account IDs and Organizations organizational units (OUs) to exclude from the policy. Specifying an OU is the equivalent of specifying all accounts in the OU and in any of its child OUs, including any child OUs and accounts that are added at a later time.
You can specify inclusions or exclusions, but not both. If you specify an IncludeMap
, Firewall Manager applies the policy to all accounts specified by the IncludeMap
, and does not evaluate any ExcludeMap
specifications. If you do not specify an IncludeMap
, then Firewall Manager applies the policy to all accounts except for those specified by the ExcludeMap
.
You can specify account IDs, OUs, or a combination:
-
Specify account IDs by setting the key to
ACCOUNT
. For example, the following is a valid map:{“ACCOUNT” : \[“accountID1”, “accountID2”\]}
. -
Specify OUs by setting the key to
ORG_UNIT
. For example, the following is a valid map:{“ORG_UNIT” : \[“ouid111”, “ouid112”\]}
. -
Specify accounts and OUs together in a single map, separated with a comma. For example, the following is a valid map:
{“ACCOUNT” : \[“accountID1”, “accountID2”\], “ORG_UNIT” : \[“ouid111”, “ouid112”\]}
.
Sourcepub fn set_exclude_map(
self,
input: Option<HashMap<CustomerPolicyScopeIdType, Vec<String>>>,
) -> Self
pub fn set_exclude_map( self, input: Option<HashMap<CustomerPolicyScopeIdType, Vec<String>>>, ) -> Self
Specifies the Amazon Web Services account IDs and Organizations organizational units (OUs) to exclude from the policy. Specifying an OU is the equivalent of specifying all accounts in the OU and in any of its child OUs, including any child OUs and accounts that are added at a later time.
You can specify inclusions or exclusions, but not both. If you specify an IncludeMap
, Firewall Manager applies the policy to all accounts specified by the IncludeMap
, and does not evaluate any ExcludeMap
specifications. If you do not specify an IncludeMap
, then Firewall Manager applies the policy to all accounts except for those specified by the ExcludeMap
.
You can specify account IDs, OUs, or a combination:
-
Specify account IDs by setting the key to
ACCOUNT
. For example, the following is a valid map:{“ACCOUNT” : \[“accountID1”, “accountID2”\]}
. -
Specify OUs by setting the key to
ORG_UNIT
. For example, the following is a valid map:{“ORG_UNIT” : \[“ouid111”, “ouid112”\]}
. -
Specify accounts and OUs together in a single map, separated with a comma. For example, the following is a valid map:
{“ACCOUNT” : \[“accountID1”, “accountID2”\], “ORG_UNIT” : \[“ouid111”, “ouid112”\]}
.
Sourcepub fn get_exclude_map(
&self,
) -> &Option<HashMap<CustomerPolicyScopeIdType, Vec<String>>>
pub fn get_exclude_map( &self, ) -> &Option<HashMap<CustomerPolicyScopeIdType, Vec<String>>>
Specifies the Amazon Web Services account IDs and Organizations organizational units (OUs) to exclude from the policy. Specifying an OU is the equivalent of specifying all accounts in the OU and in any of its child OUs, including any child OUs and accounts that are added at a later time.
You can specify inclusions or exclusions, but not both. If you specify an IncludeMap
, Firewall Manager applies the policy to all accounts specified by the IncludeMap
, and does not evaluate any ExcludeMap
specifications. If you do not specify an IncludeMap
, then Firewall Manager applies the policy to all accounts except for those specified by the ExcludeMap
.
You can specify account IDs, OUs, or a combination:
-
Specify account IDs by setting the key to
ACCOUNT
. For example, the following is a valid map:{“ACCOUNT” : \[“accountID1”, “accountID2”\]}
. -
Specify OUs by setting the key to
ORG_UNIT
. For example, the following is a valid map:{“ORG_UNIT” : \[“ouid111”, “ouid112”\]}
. -
Specify accounts and OUs together in a single map, separated with a comma. For example, the following is a valid map:
{“ACCOUNT” : \[“accountID1”, “accountID2”\], “ORG_UNIT” : \[“ouid111”, “ouid112”\]}
.
Sourcepub fn resource_set_ids(self, input: impl Into<String>) -> Self
pub fn resource_set_ids(self, input: impl Into<String>) -> Self
Appends an item to resource_set_ids
.
To override the contents of this collection use set_resource_set_ids
.
The unique identifiers of the resource sets used by the policy.
Sourcepub fn set_resource_set_ids(self, input: Option<Vec<String>>) -> Self
pub fn set_resource_set_ids(self, input: Option<Vec<String>>) -> Self
The unique identifiers of the resource sets used by the policy.
Sourcepub fn get_resource_set_ids(&self) -> &Option<Vec<String>>
pub fn get_resource_set_ids(&self) -> &Option<Vec<String>>
The unique identifiers of the resource sets used by the policy.
Sourcepub fn policy_description(self, input: impl Into<String>) -> Self
pub fn policy_description(self, input: impl Into<String>) -> Self
Your description of the Firewall Manager policy.
Sourcepub fn set_policy_description(self, input: Option<String>) -> Self
pub fn set_policy_description(self, input: Option<String>) -> Self
Your description of the Firewall Manager policy.
Sourcepub fn get_policy_description(&self) -> &Option<String>
pub fn get_policy_description(&self) -> &Option<String>
Your description of the Firewall Manager policy.
Sourcepub fn policy_status(self, input: CustomerPolicyStatus) -> Self
pub fn policy_status(self, input: CustomerPolicyStatus) -> Self
Indicates whether the policy is in or out of an admin's policy or Region scope.
-
ACTIVE
- The administrator can manage and delete the policy. -
OUT_OF_ADMIN_SCOPE
- The administrator can view the policy, but they can't edit or delete the policy. Existing policy protections stay in place. Any new resources that come into scope of the policy won't be protected.
Sourcepub fn set_policy_status(self, input: Option<CustomerPolicyStatus>) -> Self
pub fn set_policy_status(self, input: Option<CustomerPolicyStatus>) -> Self
Indicates whether the policy is in or out of an admin's policy or Region scope.
-
ACTIVE
- The administrator can manage and delete the policy. -
OUT_OF_ADMIN_SCOPE
- The administrator can view the policy, but they can't edit or delete the policy. Existing policy protections stay in place. Any new resources that come into scope of the policy won't be protected.
Sourcepub fn get_policy_status(&self) -> &Option<CustomerPolicyStatus>
pub fn get_policy_status(&self) -> &Option<CustomerPolicyStatus>
Indicates whether the policy is in or out of an admin's policy or Region scope.
-
ACTIVE
- The administrator can manage and delete the policy. -
OUT_OF_ADMIN_SCOPE
- The administrator can view the policy, but they can't edit or delete the policy. Existing policy protections stay in place. Any new resources that come into scope of the policy won't be protected.
Sourcepub fn resource_tag_logical_operator(
self,
input: ResourceTagLogicalOperator,
) -> Self
pub fn resource_tag_logical_operator( self, input: ResourceTagLogicalOperator, ) -> Self
Specifies whether to combine multiple resource tags with AND, so that a resource must have all tags to be included or excluded, or OR, so that a resource must have at least one tag.
Default: AND
Sourcepub fn set_resource_tag_logical_operator(
self,
input: Option<ResourceTagLogicalOperator>,
) -> Self
pub fn set_resource_tag_logical_operator( self, input: Option<ResourceTagLogicalOperator>, ) -> Self
Specifies whether to combine multiple resource tags with AND, so that a resource must have all tags to be included or excluded, or OR, so that a resource must have at least one tag.
Default: AND
Sourcepub fn get_resource_tag_logical_operator(
&self,
) -> &Option<ResourceTagLogicalOperator>
pub fn get_resource_tag_logical_operator( &self, ) -> &Option<ResourceTagLogicalOperator>
Specifies whether to combine multiple resource tags with AND, so that a resource must have all tags to be included or excluded, or OR, so that a resource must have at least one tag.
Default: AND
Trait Implementations§
Source§impl Clone for PolicyBuilder
impl Clone for PolicyBuilder
Source§fn clone(&self) -> PolicyBuilder
fn clone(&self) -> PolicyBuilder
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for PolicyBuilder
impl Debug for PolicyBuilder
Source§impl Default for PolicyBuilder
impl Default for PolicyBuilder
Source§fn default() -> PolicyBuilder
fn default() -> PolicyBuilder
Source§impl PartialEq for PolicyBuilder
impl PartialEq for PolicyBuilder
impl StructuralPartialEq for PolicyBuilder
Auto Trait Implementations§
impl Freeze for PolicyBuilder
impl RefUnwindSafe for PolicyBuilder
impl Send for PolicyBuilder
impl Sync for PolicyBuilder
impl Unpin for PolicyBuilder
impl UnwindSafe for PolicyBuilder
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);