binius_field::underlier

Struct SmallU

source
pub struct SmallU<const N: usize>(/* private fields */);
Expand description

Unsigned type with a size strictly less than 8 bits.

Implementations§

source§

impl<const N: usize> SmallU<N>

source

pub const fn new(val: u8) -> Self

source

pub const fn new_unchecked(val: u8) -> Self

source

pub const fn val(&self) -> u8

source

pub fn checked_add(self, rhs: Self) -> Option<Self>

source

pub fn checked_sub(self, rhs: Self) -> Option<Self>

Trait Implementations§

source§

impl<const N: usize> BitAnd for SmallU<N>

source§

type Output = SmallU<N>

The resulting type after applying the & operator.
source§

fn bitand(self, rhs: SmallU<N>) -> SmallU<N>

Performs the & operation. Read more
source§

impl<const N: usize> BitAndAssign for SmallU<N>

source§

fn bitand_assign(&mut self, rhs: SmallU<N>)

Performs the &= operation. Read more
source§

impl<const N: usize> BitOr for SmallU<N>

source§

type Output = SmallU<N>

The resulting type after applying the | operator.
source§

fn bitor(self, rhs: SmallU<N>) -> SmallU<N>

Performs the | operation. Read more
source§

impl<const N: usize> BitOrAssign for SmallU<N>

source§

fn bitor_assign(&mut self, rhs: SmallU<N>)

Performs the |= operation. Read more
source§

impl<const N: usize> BitXor for SmallU<N>

source§

type Output = SmallU<N>

The resulting type after applying the ^ operator.
source§

fn bitxor(self, rhs: SmallU<N>) -> SmallU<N>

Performs the ^ operation. Read more
source§

impl<const N: usize> BitXorAssign for SmallU<N>

source§

fn bitxor_assign(&mut self, rhs: SmallU<N>)

Performs the ^= operation. Read more
source§

impl<const N: usize> Clone for SmallU<N>

source§

fn clone(&self) -> SmallU<N>

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

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

Performs copy-assignment from source. Read more
source§

impl<const N: usize> ConditionallySelectable for SmallU<N>

source§

fn conditional_select(a: &Self, b: &Self, choice: Choice) -> Self

Select a or b according to choice. Read more
source§

fn conditional_assign(&mut self, other: &Self, choice: Choice)

Conditionally assign other to self, according to choice. Read more
source§

fn conditional_swap(a: &mut Self, b: &mut Self, choice: Choice)

Conditionally swap self and other if choice == 1; otherwise, reassign both unto themselves. Read more
source§

impl<const N: usize> ConstantTimeEq for SmallU<N>

source§

fn ct_eq(&self, other: &Self) -> Choice

Determine if two items are equal. Read more
source§

fn ct_ne(&self, other: &Self) -> Choice

Determine if two items are NOT equal. Read more
source§

impl<const N: usize> Debug for SmallU<N>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<const N: usize> Default for SmallU<N>

source§

fn default() -> SmallU<N>

Returns the “default value” for a type. Read more
source§

impl<const N: usize> Display for SmallU<N>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl From<SmallU<1>> for BinaryField1b

source§

fn from(val: U1) -> Self

Converts to this type from the input type.
source§

impl From<SmallU<1>> for SmallU<2>

source§

fn from(value: SmallU<1>) -> Self

Converts to this type from the input type.
source§

impl From<SmallU<1>> for SmallU<4>

source§

fn from(value: SmallU<1>) -> Self

Converts to this type from the input type.
source§

impl From<SmallU<2>> for BinaryField2b

source§

fn from(val: U2) -> Self

Converts to this type from the input type.
source§

impl From<SmallU<2>> for SmallU<4>

source§

fn from(value: SmallU<2>) -> Self

Converts to this type from the input type.
source§

impl From<SmallU<4>> for BinaryField4b

source§

fn from(val: U4) -> Self

Converts to this type from the input type.
source§

impl<const N: usize> From<SmallU<N>> for u128

source§

fn from(value: SmallU<N>) -> Self

Converts to this type from the input type.
source§

impl<const N: usize> From<SmallU<N>> for u16

source§

fn from(value: SmallU<N>) -> Self

Converts to this type from the input type.
source§

impl<const N: usize> From<SmallU<N>> for u32

source§

fn from(value: SmallU<N>) -> Self

Converts to this type from the input type.
source§

impl<const N: usize> From<SmallU<N>> for u64

source§

fn from(value: SmallU<N>) -> Self

Converts to this type from the input type.
source§

impl<const N: usize> From<SmallU<N>> for u8

source§

fn from(value: SmallU<N>) -> Self

Converts to this type from the input type.
source§

impl<const N: usize> From<SmallU<N>> for usize

source§

fn from(value: SmallU<N>) -> Self

Converts to this type from the input type.
source§

impl<const N: usize> Hash for SmallU<N>

source§

fn hash<H: Hasher>(&self, state: &mut H)

Feeds this value into the given Hasher. Read more
1.6.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl<const N: usize> LowerHex for SmallU<N>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<const N: usize> Not for SmallU<N>

source§

type Output = SmallU<N>

The resulting type after applying the ! operator.
source§

fn not(self) -> Self::Output

Performs the unary ! operation. Read more
source§

impl NumCast<SmallU<1>> for U2

source§

fn num_cast_from(val: U1) -> Self

source§

impl NumCast<SmallU<1>> for U4

source§

fn num_cast_from(val: U1) -> Self

source§

impl NumCast<SmallU<1>> for u128

source§

fn num_cast_from(val: U1) -> Self

source§

impl NumCast<SmallU<1>> for u16

source§

fn num_cast_from(val: U1) -> Self

source§

impl NumCast<SmallU<1>> for u32

source§

fn num_cast_from(val: U1) -> Self

source§

impl NumCast<SmallU<1>> for u64

source§

fn num_cast_from(val: U1) -> Self

source§

impl NumCast<SmallU<1>> for u8

source§

fn num_cast_from(val: U1) -> Self

source§

impl NumCast<SmallU<2>> for U1

source§

fn num_cast_from(val: U2) -> Self

source§

impl NumCast<SmallU<2>> for U4

source§

fn num_cast_from(val: U2) -> Self

source§

impl NumCast<SmallU<2>> for u128

source§

fn num_cast_from(val: U2) -> Self

source§

impl NumCast<SmallU<2>> for u16

source§

fn num_cast_from(val: U2) -> Self

source§

impl NumCast<SmallU<2>> for u32

source§

fn num_cast_from(val: U2) -> Self

source§

impl NumCast<SmallU<2>> for u64

source§

fn num_cast_from(val: U2) -> Self

source§

impl NumCast<SmallU<2>> for u8

source§

fn num_cast_from(val: U2) -> Self

source§

impl NumCast<SmallU<4>> for U1

source§

fn num_cast_from(val: U4) -> Self

source§

impl NumCast<SmallU<4>> for U2

source§

fn num_cast_from(val: U4) -> Self

source§

impl NumCast<SmallU<4>> for u128

source§

fn num_cast_from(val: U4) -> Self

source§

impl NumCast<SmallU<4>> for u16

source§

fn num_cast_from(val: U4) -> Self

source§

impl NumCast<SmallU<4>> for u32

source§

fn num_cast_from(val: U4) -> Self

source§

impl NumCast<SmallU<4>> for u64

source§

fn num_cast_from(val: U4) -> Self

source§

impl NumCast<SmallU<4>> for u8

source§

fn num_cast_from(val: U4) -> Self

source§

impl<const N: usize> Ord for SmallU<N>

source§

fn cmp(&self, other: &SmallU<N>) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
source§

impl<const N: usize> PartialEq for SmallU<N>

source§

fn eq(&self, other: &SmallU<N>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.6.0 · source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<const N: usize> PartialOrd for SmallU<N>

source§

fn partial_cmp(&self, other: &SmallU<N>) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.6.0 · source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.6.0 · source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.6.0 · source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.6.0 · source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl<const N: usize> Random for SmallU<N>

source§

fn random(rng: impl RngCore) -> Self

Generate random value
source§

impl<const N: usize> Shl<usize> for SmallU<N>

source§

type Output = SmallU<N>

The resulting type after applying the << operator.
source§

fn shl(self, rhs: usize) -> Self::Output

Performs the << operation. Read more
source§

impl<const N: usize> Shr<usize> for SmallU<N>

source§

type Output = SmallU<N>

The resulting type after applying the >> operator.
source§

fn shr(self, rhs: usize) -> Self::Output

Performs the >> operation. Read more
source§

impl TransparentWrapper<SmallU<1>> for BinaryField1b

§

fn wrap(s: Inner) -> Self
where Self: Sized,

Convert the inner type into the wrapper type.
§

fn wrap_ref(s: &Inner) -> &Self

Convert a reference to the inner type into a reference to the wrapper type.
§

fn wrap_mut(s: &mut Inner) -> &mut Self

Convert a mutable reference to the inner type into a mutable reference to the wrapper type.
§

fn wrap_slice(s: &[Inner]) -> &[Self]
where Self: Sized,

Convert a slice to the inner type into a slice to the wrapper type.
§

fn wrap_slice_mut(s: &mut [Inner]) -> &mut [Self]
where Self: Sized,

Convert a mutable slice to the inner type into a mutable slice to the wrapper type.
§

fn peel(s: Self) -> Inner
where Self: Sized,

Convert the wrapper type into the inner type.
§

fn peel_ref(s: &Self) -> &Inner

Convert a reference to the wrapper type into a reference to the inner type.
§

fn peel_mut(s: &mut Self) -> &mut Inner

Convert a mutable reference to the wrapper type into a mutable reference to the inner type.
§

fn peel_slice(s: &[Self]) -> &[Inner]
where Self: Sized,

Convert a slice to the wrapped type into a slice to the inner type.
§

fn peel_slice_mut(s: &mut [Self]) -> &mut [Inner]
where Self: Sized,

Convert a mutable slice to the wrapped type into a mutable slice to the inner type.
source§

impl TransparentWrapper<SmallU<2>> for BinaryField2b

§

fn wrap(s: Inner) -> Self
where Self: Sized,

Convert the inner type into the wrapper type.
§

fn wrap_ref(s: &Inner) -> &Self

Convert a reference to the inner type into a reference to the wrapper type.
§

fn wrap_mut(s: &mut Inner) -> &mut Self

Convert a mutable reference to the inner type into a mutable reference to the wrapper type.
§

fn wrap_slice(s: &[Inner]) -> &[Self]
where Self: Sized,

Convert a slice to the inner type into a slice to the wrapper type.
§

fn wrap_slice_mut(s: &mut [Inner]) -> &mut [Self]
where Self: Sized,

Convert a mutable slice to the inner type into a mutable slice to the wrapper type.
§

fn peel(s: Self) -> Inner
where Self: Sized,

Convert the wrapper type into the inner type.
§

fn peel_ref(s: &Self) -> &Inner

Convert a reference to the wrapper type into a reference to the inner type.
§

fn peel_mut(s: &mut Self) -> &mut Inner

Convert a mutable reference to the wrapper type into a mutable reference to the inner type.
§

fn peel_slice(s: &[Self]) -> &[Inner]
where Self: Sized,

Convert a slice to the wrapped type into a slice to the inner type.
§

fn peel_slice_mut(s: &mut [Self]) -> &mut [Inner]
where Self: Sized,

Convert a mutable slice to the wrapped type into a mutable slice to the inner type.
source§

impl TransparentWrapper<SmallU<4>> for BinaryField4b

§

fn wrap(s: Inner) -> Self
where Self: Sized,

Convert the inner type into the wrapper type.
§

fn wrap_ref(s: &Inner) -> &Self

Convert a reference to the inner type into a reference to the wrapper type.
§

fn wrap_mut(s: &mut Inner) -> &mut Self

Convert a mutable reference to the inner type into a mutable reference to the wrapper type.
§

fn wrap_slice(s: &[Inner]) -> &[Self]
where Self: Sized,

Convert a slice to the inner type into a slice to the wrapper type.
§

fn wrap_slice_mut(s: &mut [Inner]) -> &mut [Self]
where Self: Sized,

Convert a mutable slice to the inner type into a mutable slice to the wrapper type.
§

fn peel(s: Self) -> Inner
where Self: Sized,

Convert the wrapper type into the inner type.
§

fn peel_ref(s: &Self) -> &Inner

Convert a reference to the wrapper type into a reference to the inner type.
§

fn peel_mut(s: &mut Self) -> &mut Inner

Convert a mutable reference to the wrapper type into a mutable reference to the inner type.
§

fn peel_slice(s: &[Self]) -> &[Inner]
where Self: Sized,

Convert a slice to the wrapped type into a slice to the inner type.
§

fn peel_slice_mut(s: &mut [Self]) -> &mut [Inner]
where Self: Sized,

Convert a mutable slice to the wrapped type into a mutable slice to the inner type.
source§

impl<const N: usize> UnderlierType for SmallU<N>

source§

const LOG_BITS: usize = _

Number of bits in value
source§

const BITS: usize = _

Number of bits used to represent a value. This may not be equal to the number of bits in a type instance.
source§

impl<const N: usize> UnderlierWithBitOps for SmallU<N>

source§

const ZERO: Self = _

source§

const ONE: Self = _

source§

const ONES: Self = _

source§

fn fill_with_bit(val: u8) -> Self

Fill value with the given bit val must be 0 or 1.
source§

fn from_fn<T>(f: impl FnMut(usize) -> T) -> Self
where T: UnderlierType, Self: From<T>,

source§

fn broadcast_subvalue<T>(value: T) -> Self
where T: UnderlierType, Self: From<T>,

Broadcast subvalue to fill Self. Self::BITS/T::BITS is supposed to be a power of 2.
source§

unsafe fn get_subvalue<T>(&self, i: usize) -> T
where T: UnderlierType + NumCast<Self>,

Gets the subvalue from the given position. Function panics in case when index is out of range. Read more
source§

unsafe fn set_subvalue<T>(&mut self, i: usize, val: T)
where T: UnderlierWithBitOps, Self: From<T>,

Sets the subvalue in the given position. Function panics in case when index is out of range. Read more
source§

impl<const N: usize> Zeroable for SmallU<N>

§

fn zeroed() -> Self

source§

impl<const N: usize> Copy for SmallU<N>

source§

impl<const N: usize> Eq for SmallU<N>

source§

impl<const N: usize> NoUninit for SmallU<N>

source§

impl<const N: usize> StructuralPartialEq for SmallU<N>

Auto Trait Implementations§

§

impl<const N: usize> Freeze for SmallU<N>

§

impl<const N: usize> RefUnwindSafe for SmallU<N>

§

impl<const N: usize> Send for SmallU<N>

§

impl<const N: usize> Sync for SmallU<N>

§

impl<const N: usize> Unpin for SmallU<N>

§

impl<const N: usize> UnwindSafe for SmallU<N>

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> CloneToUninit for T
where T: Clone,

source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
source§

impl<U> Divisible<U> for U
where U: UnderlierType,

source§

fn split_ref(&self) -> &[U]

source§

fn split_mut(&mut self) -> &mut [U]

source§

const WIDTH: usize = _

source§

fn split_slice(values: &[Self]) -> &[U]

source§

fn split_slice_mut(values: &mut [Self]) -> &mut [U]

source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> IntoEither for T

source§

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 more
source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
source§

impl<U> NumCast<U> for U
where U: UnderlierType,

source§

fn num_cast_from(val: U) -> U

§

impl<T> Pointable for T

§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

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

source§

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> ToString for T
where T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

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

source§

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>,

source§

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.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
source§

impl<U> WithUnderlier for U
where U: UnderlierType,

source§

type Underlier = U

Underlier primitive type
source§

fn to_underlier(self) -> <U as WithUnderlier>::Underlier

Convert value to underlier.
source§

fn to_underlier_ref(&self) -> &<U as WithUnderlier>::Underlier

source§

fn to_underlier_ref_mut(&mut self) -> &mut <U as WithUnderlier>::Underlier

source§

fn to_underliers_ref(val: &[U]) -> &[<U as WithUnderlier>::Underlier]

source§

fn to_underliers_ref_mut( val: &mut [U], ) -> &mut [<U as WithUnderlier>::Underlier]

source§

fn from_underlier(val: <U as WithUnderlier>::Underlier) -> U

source§

fn from_underlier_ref(val: &<U as WithUnderlier>::Underlier) -> &U

source§

fn from_underlier_ref_mut(val: &mut <U as WithUnderlier>::Underlier) -> &mut U

source§

fn from_underliers_ref(val: &[<U as WithUnderlier>::Underlier]) -> &[U]

source§

fn from_underliers_ref_mut( val: &mut [<U as WithUnderlier>::Underlier], ) -> &mut [U]

source§

fn mutate_underlier( self, f: impl FnOnce(Self::Underlier) -> Self::Underlier, ) -> Self