Struct tock_registers::fields::Field
source · [−]pub struct Field<T: UIntLike, R: RegisterLongName> {
pub mask: T,
pub shift: usize,
/* private fields */
}
Expand description
Specific section of a register.
For the Field, the mask is unshifted, ie. the LSB should always be set.
Fields
mask: T
shift: usize
Implementations
sourceimpl<T: UIntLike, R: RegisterLongName> Field<T, R>
impl<T: UIntLike, R: RegisterLongName> Field<T, R>
pub const fn new(mask: T, shift: usize) -> Field<T, R>
pub fn read(self, val: T) -> T
sourcepub fn read_as_enum<E: TryFromValue<T, EnumType = E>>(self, val: T) -> Option<E>
pub fn read_as_enum<E: TryFromValue<T, EnumType = E>>(self, val: T) -> Option<E>
Read value of the field as an enum member
sourceimpl<R: RegisterLongName> Field<u8, R>
impl<R: RegisterLongName> Field<u8, R>
pub fn val(&self, value: u8) -> FieldValue<u8, R>
sourceimpl<R: RegisterLongName> Field<u16, R>
impl<R: RegisterLongName> Field<u16, R>
pub fn val(&self, value: u16) -> FieldValue<u16, R>
sourceimpl<R: RegisterLongName> Field<u32, R>
impl<R: RegisterLongName> Field<u32, R>
pub fn val(&self, value: u32) -> FieldValue<u32, R>
sourceimpl<R: RegisterLongName> Field<u64, R>
impl<R: RegisterLongName> Field<u64, R>
pub fn val(&self, value: u64) -> FieldValue<u64, R>
sourceimpl<R: RegisterLongName> Field<u128, R>
impl<R: RegisterLongName> Field<u128, R>
pub fn val(&self, value: u128) -> FieldValue<u128, R>
sourceimpl<R: RegisterLongName> Field<usize, R>
impl<R: RegisterLongName> Field<usize, R>
pub fn val(&self, value: usize) -> FieldValue<usize, R>
Trait Implementations
sourceimpl<T: UIntLike, R: RegisterLongName> Clone for Field<T, R>
impl<T: UIntLike, R: RegisterLongName> Clone for Field<T, R>
impl<T: UIntLike, R: RegisterLongName> Copy for Field<T, R>
Auto Trait Implementations
impl<T, R> RefUnwindSafe for Field<T, R> where
R: RefUnwindSafe,
T: RefUnwindSafe,
impl<T, R> Send for Field<T, R> where
R: Send,
T: Send,
impl<T, R> Sync for Field<T, R> where
R: Sync,
T: Sync,
impl<T, R> Unpin for Field<T, R> where
R: Unpin,
T: Unpin,
impl<T, R> UnwindSafe for Field<T, R> where
R: UnwindSafe,
T: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more