AvrAtomicConvert

Trait AvrAtomicConvert 

Source
pub trait AvrAtomicConvert: Copy {
    // Required methods
    fn from_u8(value: u8) -> Self;
    fn to_u8(self) -> u8;
}
Expand description

Trait convert to and from the raw u8 value.

Required Methods§

Source

fn from_u8(value: u8) -> Self

Convert from u8 to Self.

§Implementation hint

This function must create a valid Self value from the value byte. Note that a value of 0_u8 must always be expected and handled correctly, because 0_u8 is the initialization value of AvrAtomic.

It is guaranteed that AvrAtomic only ever passes values to from_u8 that came from to_u8() or are equal to 0_u8. Note that 0_u8 can be passed to from_u8 even if to_u8() never returned 0_u8.

Source

fn to_u8(self) -> u8

Convert from Self to u8.

§Implementation hint

This function must create an u8 byte that is possible to be converted back into the same Self value by from_u8.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl AvrAtomicConvert for bool

Source§

fn from_u8(value: u8) -> Self

Source§

fn to_u8(self) -> u8

Source§

impl AvrAtomicConvert for i8

Source§

fn from_u8(value: u8) -> Self

Source§

fn to_u8(self) -> u8

Source§

impl AvrAtomicConvert for u8

Source§

fn from_u8(value: u8) -> Self

Source§

fn to_u8(self) -> u8

Implementors§