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

source

pub fn kind(&self) -> NumberKind

Get the number kind.

source

pub fn default_value(&self) -> NumberValue

Interpret the default value as NumberValue.

source

pub fn behavior_type(&self) -> &BehaviorArg

Get the behavior type.

source

pub fn lower_limit_value(&self) -> NumberValue

Interpret the lower limit value as NumberValue.

source

pub fn lower_limit_token(&self) -> TokenStream

Output the lower limit value as a bare literal in a token stream.

source

pub fn upper_limit_value(&self) -> NumberValue

Interpret the upper limit value as NumberValue.

source

pub fn upper_limit_token(&self) -> TokenStream

Output the upper limit value as a bare literal in a token stream.

source

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.

source

pub fn is_signed(&self) -> bool

source

pub fn is_u16_or_smaller(&self) -> bool

Check if the number kind is u16 or smaller.

source

pub fn is_u16_or_larger(&self) -> bool

Check if the number kind is u16 or larger.

source

pub fn is_u32_or_smaller(&self) -> bool

Check if the number kind is u32 or smaller.

source

pub fn is_u32_or_larger(&self) -> bool

Check if the number kind is u32 or larger.

source

pub fn is_u64_or_smaller(&self) -> bool

Check if the number kind is u64 or smaller.

source

pub fn is_u64_or_larger(&self) -> bool

Check if the number kind is u64 or larger.

source

pub fn is_usize_or_smaller(&self) -> bool

source

pub fn is_usize_or_larger(&self) -> bool

source

pub fn is_u128_or_smaller(&self) -> bool

Check if the number kind is u128 or smaller.

source

pub fn is_i16_or_smaller(&self) -> bool

source

pub fn is_i16_or_larger(&self) -> bool

source

pub fn is_i32_or_smaller(&self) -> bool

source

pub fn is_i32_or_larger(&self) -> bool

source

pub fn is_i64_or_smaller(&self) -> bool

source

pub fn is_i64_or_larger(&self) -> bool

source

pub fn is_isize_or_smaller(&self) -> bool

source

pub fn is_isize_or_larger(&self) -> bool

source

pub fn is_i128_or_smaller(&self) -> bool

Trait Implementations§

source§

impl Clone for AttrParams

source§

fn clone(&self) -> AttrParams

Returns a copy of the value. Read more
1.0.0 · source§

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

Performs copy-assignment from source. Read more
source§

impl Parse for AttrParams

source§

fn parse(input: ParseStream<'_>) -> Result<Self>

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

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

source§

fn into(self) -> U

Calls U::from(self).

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

source§

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

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

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

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

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

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

§

type Error = Infallible

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

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

Performs the conversion.
source§

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

§

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

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

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

Performs the conversion.