[][src]Struct bounded_registers::Field

pub struct Field<W, M, O, U, R> where
    U: IsGreater<U0, Output = True>, 
{ /* fields omitted */ }

A field in a register parameterized by its mask, offset, and upper bound. To construct a field, its val must be ⩽ U::U32.

It uses these type-level numbers so that the mask and offset can be constant.

Methods

impl<W, M: Unsigned, O: Unsigned, U: Unsigned, R> Field<W, M, O, U, R> where
    U: IsGreater<U0, Output = True> + ReifyTo<W>,
    W: Copy + Clone + PartialOrd + BitAnd<W, Output = W> + Shr<W, Output = W> + Default,
    U: ReifyTo<W>,
    U0: ReifyTo<W>, 
[src]

pub fn new(val: W) -> Option<Self>[src]

New returns a Some(Field) if the given value is less than or equal to its upper bound, otherwise it returns None.

pub fn set(self, val: W) -> Option<Self>[src]

set takes an existing field sets its value to val. If val is notU, it returns None.

pub fn val(&self) -> W[src]

val retrieves the value from the field.

pub fn is_set(&self) -> bool[src]

is_set returns whether or not the field's val is equal to its upper bound.

impl<M: Unsigned, O: Unsigned, U: Unsigned, R> Field<u8, M, O, U, R> where
    U: IsGreater<U0, Output = True>, 
[src]

pub const fn checked<V: Unsigned>() -> Self where
    V: IsLessOrEqual<U, Output = True>,
    V: IsGreaterOrEqual<U0, Output = True>, 
[src]

checked is a compile-time checked constructor for a Field. Its V parameter must be ⩽ U; if it is not, the program will fail to typecheck.

impl<M: Unsigned, O: Unsigned, U: Unsigned, R> Field<u16, M, O, U, R> where
    U: IsGreater<U0, Output = True>, 
[src]

pub const fn checked<V: Unsigned>() -> Self where
    V: IsLessOrEqual<U, Output = True>,
    V: IsGreaterOrEqual<U0, Output = True>, 
[src]

checked is a compile-time checked constructor for a Field. Its V parameter must be ⩽ U; if it is not, the program will fail to typecheck.

impl<M: Unsigned, O: Unsigned, U: Unsigned, R> Field<u32, M, O, U, R> where
    U: IsGreater<U0, Output = True>, 
[src]

pub const fn checked<V: Unsigned>() -> Self where
    V: IsLessOrEqual<U, Output = True>,
    V: IsGreaterOrEqual<U0, Output = True>, 
[src]

checked is a compile-time checked constructor for a Field. Its V parameter must be ⩽ U; if it is not, the program will fail to typecheck.

impl<M: Unsigned, O: Unsigned, U: Unsigned, R> Field<u64, M, O, U, R> where
    U: IsGreater<U0, Output = True>, 
[src]

pub const fn checked<V: Unsigned>() -> Self where
    V: IsLessOrEqual<U, Output = True>,
    V: IsGreaterOrEqual<U0, Output = True>, 
[src]

checked is a compile-time checked constructor for a Field. Its V parameter must be ⩽ U; if it is not, the program will fail to typecheck.

impl<M: Unsigned, O: Unsigned, U: Unsigned, R> Field<usize, M, O, U, R> where
    U: IsGreater<U0, Output = True>, 
[src]

pub const fn checked<V: Unsigned>() -> Self where
    V: IsLessOrEqual<U, Output = True>,
    V: IsGreaterOrEqual<U0, Output = True>, 
[src]

checked is a compile-time checked constructor for a Field. Its V parameter must be ⩽ U; if it is not, the program will fail to typecheck.

Trait Implementations

impl<W, M: Unsigned, O: Unsigned, U: Unsigned, R> Positioned for Field<W, M, O, U, R> where
    U: IsGreater<U0, Output = True> + ReifyTo<W>,
    W: Copy + Clone + PartialOrd + BitAnd<W, Output = W> + Shr<W, Output = W> + Default + Shl<W, Output = W>,
    M: ReifyTo<W>,
    U0: ReifyTo<W>,
    O: ReifyTo<W>, 
[src]

type Width = W

fn mask(&self) -> W[src]

The mask for this positioned value.

fn in_position(&self) -> W[src]

Presents a value as its register-relative value.

impl<W: Debug, M: Debug, O: Debug, U: Debug, R: Debug> Debug for Field<W, M, O, U, R> where
    U: IsGreater<U0, Output = True>, 
[src]

impl<W, M: Unsigned, O: Unsigned, U: Unsigned, R> PartialEq<Field<W, M, O, U, R>> for Field<W, M, O, U, R> where
    U: IsGreater<U0, Output = True> + ReifyTo<W>,
    W: Copy + Clone + PartialOrd + BitAnd<W, Output = W> + Shr<W, Output = W> + Default,
    U0: ReifyTo<W>, 
[src]

impl<W, LM: Unsigned, LO: Unsigned, LU: Unsigned, LR, RM: Unsigned, RO: Unsigned, RU: Unsigned, RR> Add<Field<W, RM, RO, RU, RR>> for Field<W, LM, LO, LU, LR> where
    LU: IsGreater<U0, Output = True> + ReifyTo<W>,
    RU: IsGreater<U0, Output = True> + ReifyTo<W>,
    RO: ReifyTo<W>,
    LO: ReifyTo<W>,
    W: Copy + Clone + PartialOrd + BitAnd<W, Output = W> + Shr<W, Output = W> + Default + Shl<W, Output = W> + BitOr<W, Output = W>,
    U0: ReifyTo<W>,
    LM: BitOr<RM>,
    <LM as BitOr<RM>>::Output: ReifyTo<W>, 
[src]

type Output = FieldDisj<W>

The resulting type after applying the + operator.

impl<W, M: Unsigned, O: Unsigned, U: Unsigned, R> Add<FieldDisj<W>> for Field<W, M, O, U, R> where
    U: IsGreater<U0, Output = True> + ReifyTo<W>,
    W: Copy + Clone + PartialOrd + BitAnd<W, Output = W> + Shr<W, Output = W> + Default + Shl<W, Output = W> + BitOr<W, Output = W>,
    U0: ReifyTo<W>,
    O: ReifyTo<W>,
    M: ReifyTo<W>, 
[src]

type Output = FieldDisj<W>

The resulting type after applying the + operator.

impl<W, M: Unsigned, O: Unsigned, U: Unsigned, R> Add<Field<W, M, O, U, R>> for FieldDisj<W> where
    U: IsGreater<U0, Output = True> + ReifyTo<W>,
    W: Copy + Clone + PartialOrd + BitAnd<W, Output = W> + Shr<W, Output = W> + Default + Shl<W, Output = W> + BitOr<W, Output = W>,
    U0: ReifyTo<W>,
    O: ReifyTo<W>,
    M: ReifyTo<W>, 
[src]

type Output = FieldDisj<W>

The resulting type after applying the + operator.

Auto Trait Implementations

impl<W, M, O, U, R> Unpin for Field<W, M, O, U, R> where
    M: Unpin,
    O: Unpin,
    R: Unpin,
    U: Unpin,
    W: Unpin

impl<W, M, O, U, R> Send for Field<W, M, O, U, R> where
    M: Send,
    O: Send,
    R: Send,
    U: Send,
    W: Send

impl<W, M, O, U, R> Sync for Field<W, M, O, U, R> where
    M: Sync,
    O: Sync,
    R: Sync,
    U: Sync,
    W: Sync

Blanket Implementations

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Same<T> for T[src]

type Output = T

Should always be Self