Trait drone::reg::RegValue
[−]
[src]
pub trait RegValue where
Self: Sized + Default, { type Raw: RegRaw; fn new(value: Self::Raw) -> Self; fn raw(&self) -> Self::Raw; fn raw_mut(&mut self) -> &mut Self::Raw; fn bit(&self, offset: Self::Raw) -> bool { ... } fn set_bit(&mut self, offset: Self::Raw, value: bool) -> &mut Self { ... } fn bits(&self, offset: Self::Raw, width: Self::Raw) -> Self::Raw { ... } fn set_bits(
&mut self,
offset: Self::Raw,
width: Self::Raw,
value: Self::Raw
) -> &mut Self { ... } }
Wrapper for a corresponding register's value.
Associated Types
Required Methods
fn new(value: Self::Raw) -> Self
Constructs a wrapper from the raw register value
.
fn raw(&self) -> Self::Raw
Returns the raw integer value.
fn raw_mut(&mut self) -> &mut Self::Raw
Returns a mutable reference to the raw integer value.
Provided Methods
fn bit(&self, offset: Self::Raw) -> bool
Checks the set state of the bit of the register's value by offset
.
Panics
If offset
is greater than or equals to the platform's word size in bits.
fn set_bit(&mut self, offset: Self::Raw, value: bool) -> &mut Self
Sets or clears the bit of the register's value by offset
.
Panics
If offset
is greater than or equals to the platform's word size in bits.
fn bits(&self, offset: Self::Raw, width: Self::Raw) -> Self::Raw
Reads the width
number of low order bits at the offset
position from
the raw interger value.
Panics
- If
offset
is greater than or equals to the platform's word size in bits. - If
width + offset
is greater than the platform's word size in bits.
fn set_bits(
&mut self,
offset: Self::Raw,
width: Self::Raw,
value: Self::Raw
) -> &mut Self
&mut self,
offset: Self::Raw,
width: Self::Raw,
value: Self::Raw
) -> &mut Self
Copies the width
number of low order bits from the value
into the same
number of adjacent bits at the offset
position at the raw integer value.
Panics
- If
offset
is greater than or equals to the platform's word size in bits. - If
width + offset
is greater than the platform's word size in bits. - If
value
contains bits outside the width range.