Struct checked_rs_macro_impl::params::attr_params::AttrParams
source · pub struct AttrParams {Show 19 fields
pub integer: TypePath,
pub as_soft_or_hard: Option<AsSoftOrHard>,
pub integer_semi: Option<SemiOrComma>,
pub default_kw: default,
pub default_eq: Eq,
pub default_val: NumberArg,
pub default_semi: Option<SemiOrComma>,
pub behavior_kw: behavior,
pub behavior_eq: Eq,
pub behavior_val: BehaviorArg,
pub behavior_semi: Option<SemiOrComma>,
pub lower_kw: Option<lower>,
pub lower_eq: Option<Eq>,
pub lower_val: Option<NumberArg>,
pub lower_semi: Option<SemiOrComma>,
pub upper_kw: Option<upper>,
pub upper_eq: Option<Eq>,
pub upper_val: Option<NumberArg>,
pub upper_semi: Option<SemiOrComma>,
}Expand description
Represents the parameters of the clamped attribute.
Only the integer and default parameters are required.
The integer parameter must be first while the order of the rest is not important.
Fields§
§integer: TypePath§as_soft_or_hard: Option<AsSoftOrHard>§integer_semi: Option<SemiOrComma>§default_kw: default§default_eq: Eq§default_val: NumberArg§default_semi: Option<SemiOrComma>§behavior_kw: behavior§behavior_eq: Eq§behavior_val: BehaviorArg§behavior_semi: Option<SemiOrComma>§lower_kw: Option<lower>§lower_eq: Option<Eq>§lower_val: Option<NumberArg>§lower_semi: Option<SemiOrComma>§upper_kw: Option<upper>§upper_eq: Option<Eq>§upper_val: Option<NumberArg>§upper_semi: Option<SemiOrComma>Implementations§
source§impl AttrParams
impl AttrParams
sourcepub fn kind(&self) -> NumberKind
pub fn kind(&self) -> NumberKind
Get the number kind.
sourcepub fn default_value(&self) -> NumberValue
pub fn default_value(&self) -> NumberValue
Interpret the default value as NumberValue.
sourcepub fn behavior_type(&self) -> &BehaviorArg
pub fn behavior_type(&self) -> &BehaviorArg
Get the behavior type.
sourcepub fn lower_limit_value(&self) -> NumberValue
pub fn lower_limit_value(&self) -> NumberValue
Interpret the lower limit value as NumberValue.
sourcepub fn lower_limit_token(&self) -> TokenStream
pub fn lower_limit_token(&self) -> TokenStream
Output the lower limit value as a bare literal in a token stream.
sourcepub fn upper_limit_value(&self) -> NumberValue
pub fn upper_limit_value(&self) -> NumberValue
Interpret the upper limit value as NumberValue.
sourcepub fn upper_limit_token(&self) -> TokenStream
pub fn upper_limit_token(&self) -> TokenStream
Output the upper limit value as a bare literal in a token stream.
sourcepub fn abort_if_out_of_bounds<T: Spanned + ToTokens>(
&self,
ast: &T,
value: NumberValue,
)
pub fn abort_if_out_of_bounds<T: Spanned + ToTokens>( &self, ast: &T, value: NumberValue, )
Validate that an arbitrary value is within the lower and upper limit.
pub fn is_signed(&self) -> bool
sourcepub fn is_u16_or_smaller(&self) -> bool
pub fn is_u16_or_smaller(&self) -> bool
Check if the number kind is u16 or smaller.
sourcepub fn is_u16_or_larger(&self) -> bool
pub fn is_u16_or_larger(&self) -> bool
Check if the number kind is u16 or larger.
sourcepub fn is_u32_or_smaller(&self) -> bool
pub fn is_u32_or_smaller(&self) -> bool
Check if the number kind is u32 or smaller.
sourcepub fn is_u32_or_larger(&self) -> bool
pub fn is_u32_or_larger(&self) -> bool
Check if the number kind is u32 or larger.
sourcepub fn is_u64_or_smaller(&self) -> bool
pub fn is_u64_or_smaller(&self) -> bool
Check if the number kind is u64 or smaller.
sourcepub fn is_u64_or_larger(&self) -> bool
pub fn is_u64_or_larger(&self) -> bool
Check if the number kind is u64 or larger.
pub fn is_usize_or_smaller(&self) -> bool
pub fn is_usize_or_larger(&self) -> bool
sourcepub fn is_u128_or_smaller(&self) -> bool
pub fn is_u128_or_smaller(&self) -> bool
Check if the number kind is u128 or smaller.
pub fn is_i16_or_smaller(&self) -> bool
pub fn is_i16_or_larger(&self) -> bool
pub fn is_i32_or_smaller(&self) -> bool
pub fn is_i32_or_larger(&self) -> bool
pub fn is_i64_or_smaller(&self) -> bool
pub fn is_i64_or_larger(&self) -> bool
pub fn is_isize_or_smaller(&self) -> bool
pub fn is_isize_or_larger(&self) -> bool
pub fn is_i128_or_smaller(&self) -> bool
Trait Implementations§
source§impl Clone for AttrParams
impl Clone for AttrParams
source§fn clone(&self) -> AttrParams
fn clone(&self) -> AttrParams
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more