Skip to main content

Part

Enum Part 

Source
pub enum Part {
    Bytes(I2cPart),
    Words(Box<WordPart>),
    Commands(CommandPart),
}
Expand description

A simulated part of any of the three kinds, as a simulated bus holds it.

A word part carries two maps of 256 sixteen-bit registers, four times what a byte part holds, so it is boxed to keep every Part the size of the smaller two.

Variants§

§

Bytes(I2cPart)

A part whose registers are a byte wide.

§

Words(Box<WordPart>)

A part whose registers are sixteen bits wide.

§

Commands(CommandPart)

A part that takes commands.

Implementations§

Source§

impl Part

Source

pub fn address(&self) -> u8

The address this part answers to.

§Returns

The address.

Source

pub fn transfers(&self) -> usize

How many transfers the part has served.

§Returns

The count.

Trait Implementations§

Source§

impl Clone for Part

Source§

fn clone(&self) -> Part

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Part

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl ErrorType for Part

Available on crate feature alloc only.
Source§

type Error = PartError

Error type
Source§

impl From<CommandPart> for Part

Available on crate feature alloc only.
Source§

fn from(part: CommandPart) -> Part

Converts to this type from the input type.
Source§

impl From<I2cPart> for Part

Available on crate feature alloc only.
Source§

fn from(part: I2cPart) -> Part

Converts to this type from the input type.
Source§

impl From<WordPart> for Part

Available on crate feature alloc only.
Source§

fn from(part: WordPart) -> Part

Converts to this type from the input type.
Source§

impl FromPart for Part

Available on crate feature alloc only.
Source§

fn from_part(part: Part) -> Option<Part>

The part, when it is this kind. Read more
Source§

impl I2c for Part

Available on crate feature alloc only.
Source§

fn transaction( &mut self, address: SevenBitAddress, operations: &mut [Operation<'_>], ) -> Result<(), Self::Error>

Execute the provided operations on the I2C bus. Read more
§

fn read(&mut self, address: A, read: &mut [u8]) -> Result<(), Self::Error>

Reads enough bytes from slave with address to fill read. Read more
§

fn write(&mut self, address: A, write: &[u8]) -> Result<(), Self::Error>

Writes bytes to slave with address address. Read more
§

fn write_read( &mut self, address: A, write: &[u8], read: &mut [u8], ) -> Result<(), Self::Error>

Writes bytes to slave with address address and then reads enough bytes to fill read in a single transaction. Read more

Auto Trait Implementations§

§

impl Freeze for Part

§

impl RefUnwindSafe for Part

§

impl Send for Part

§

impl Sync for Part

§

impl Unpin for Part

§

impl UnsafeUnpin for Part

§

impl UnwindSafe for Part

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.