pub struct TypeSize(/* private fields */);Expand description
Byte size of a fixed-bytes, integer, or fixed-point number (M) type. Valid values: 0..=32.
Implementations§
Source§impl TypeSize
impl TypeSize
Sourcepub const ZERO: TypeSize
pub const ZERO: TypeSize
The value zero. Note that this is not a valid size for a fixed-bytes type.
Sourcepub const fn new(bytes: u8) -> Option<TypeSize>
pub const fn new(bytes: u8) -> Option<TypeSize>
Creates a new TypeSize from a u8 number of bytes.
Sourcepub fn new_int_bits(bits: u16) -> TypeSize
pub fn new_int_bits(bits: u16) -> TypeSize
Creates a new TypeSize from a u8 number of bits.
Panics if bits is not a multiple of 8 or greater than 256.
Sourcepub fn try_new_int_bits(bits: u16) -> Option<TypeSize>
pub fn try_new_int_bits(bits: u16) -> Option<TypeSize>
Creates a new TypeSize for an integer type.
Returns None if bits is not a multiple of 8 or greater than 256.
Sourcepub fn new_fb_bytes(bytes: u8) -> TypeSize
pub fn new_fb_bytes(bytes: u8) -> TypeSize
Creates a new TypeSize for a fixed-bytes type.
Panics if bytes is not in the range 1..=32.
Sourcepub fn try_new_fb_bytes(bytes: u8) -> Option<TypeSize>
pub fn try_new_fb_bytes(bytes: u8) -> Option<TypeSize>
Creates a new TypeSize for a fixed-bytes type.
Returns None if bytes is not in the range 1..=32.
Sourcepub const fn int_keyword(self) -> Symbol
pub const fn int_keyword(self) -> Symbol
Returns the int symbol for the type name.
Sourcepub const fn uint_keyword(self) -> Symbol
pub const fn uint_keyword(self) -> Symbol
Returns the uint symbol for the type name.
Sourcepub const fn bytes_keyword(self) -> Symbol
pub const fn bytes_keyword(self) -> Symbol
Trait Implementations§
Source§impl Ord for TypeSize
impl Ord for TypeSize
Source§impl PartialOrd for TypeSize
impl PartialOrd for TypeSize
impl Copy for TypeSize
impl Eq for TypeSize
impl StructuralPartialEq for TypeSize
Auto Trait Implementations§
impl Freeze for TypeSize
impl RefUnwindSafe for TypeSize
impl Send for TypeSize
impl Sync for TypeSize
impl Unpin for TypeSize
impl UnwindSafe for TypeSize
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T, R> CollectAndApply<T, R> for T
impl<T, R> CollectAndApply<T, R> for T
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
fn equivalent(&self, key: &K) -> bool
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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> ⓘ
Converts
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> ⓘ
Converts
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