#[repr(u8)]pub enum Width {
B1 = 1,
B2 = 2,
B4 = 4,
}Expand description
Byte width of the bus read/write.
Variants§
Implementations§
Source§impl Width
impl Width
Sourcepub const fn from_num_bytes(num_bytes: usize) -> Self
pub const fn from_num_bytes(num_bytes: usize) -> Self
assert_eq!(Width::from_num_bytes(1), Width::B1);
assert_eq!(Width::from_num_bytes(2), Width::B2);
assert_eq!(Width::from_num_bytes(4), Width::B4);Sourcepub const fn from_reg<T>(_: &T) -> Self
pub const fn from_reg<T>(_: &T) -> Self
Returns the width of the given RAL register instance, i.e. &RWRegister<u32> and friends.
Since RWRegister<T> is a newtype wrapper of T, this works on primitives too.
let a = 1u8;
let b = 2u16;
let c = 3i32;
assert_eq!(Width::from_reg(&a), Width::B1);
assert_eq!(Width::from_reg(&b), Width::B2);
assert_eq!(Width::from_reg(&c), Width::B4);Trait Implementations§
impl Copy for Width
impl Eq for Width
impl StructuralPartialEq for Width
Auto Trait Implementations§
impl Freeze for Width
impl RefUnwindSafe for Width
impl Send for Width
impl Sync for Width
impl Unpin for Width
impl UnwindSafe for Width
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> 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