Struct checked_rs_macro_impl::clamped::ClampParams

source ·
pub struct ClampParams {
Show 18 fields pub uinteger: TypePath, pub uinteger_semi: SemiOrComma, pub default_kw: default, pub default_eq: Eq, pub default_val: UIntegerArg, 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<UIntegerArg>, pub lower_semi: Option<SemiOrComma>, pub upper_kw: Option<upper>, pub upper_eq: Option<Eq>, pub upper_val: Option<UIntegerArg>, pub upper_semi: Option<SemiOrComma>,
}
Expand description

Represents the parameters of the clamped attribute. Only the uinteger and default parameters are required. The uinteger parameter must be first while the order of the rest is not important.

Fields§

§uinteger: TypePath§uinteger_semi: SemiOrComma§default_kw: default§default_eq: Eq§default_val: UIntegerArg§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<UIntegerArg>§lower_semi: Option<SemiOrComma>§upper_kw: Option<upper>§upper_eq: Option<Eq>§upper_val: Option<UIntegerArg>§upper_semi: Option<SemiOrComma>

Implementations§

source§

impl ClampParams

source

pub fn kind(&self) -> UIntKind

Get the unsigned integer kind.

source

pub fn default_value(&self) -> u128

Interpret the default value as u128.

source

pub fn behavior_type(&self) -> &BehaviorArg

Get the behavior type.

source

pub fn lower_limit_value(&self) -> u128

Interpret the lower limit value as u128.

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) -> u128

Interpret the upper limit value as u128.

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: u128, )

Validate that an arbitrary value is within the lower and upper limit.

source

pub fn is_u16_or_smaller(&self) -> bool

Check if the unsigned integer kind is u16 or smaller.

source

pub fn is_u16_or_larger(&self) -> bool

Check if the unsigned integer kind is u16 or larger.

source

pub fn is_u32_or_smaller(&self) -> bool

Check if the unsigned integer kind is u32 or smaller.

source

pub fn is_u32_or_larger(&self) -> bool

Check if the unsigned integer kind is u32 or larger.

source

pub fn is_u64_or_smaller(&self) -> bool

Check if the unsigned integer kind is u64 or smaller.

source

pub fn is_u64_or_larger(&self) -> bool

Check if the unsigned integer kind is u64 or larger.

source

pub fn is_u128_or_smaller(&self) -> bool

Check if the unsigned integer kind is u128 or smaller.

Trait Implementations§

source§

impl Clone for ClampParams

source§

fn clone(&self) -> ClampParams

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 ClampParams

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.