Skip to main content

DeviceBackend

Enum DeviceBackend 

Source
pub enum DeviceBackend<M = FakeMmio, G = FakeGpio, I = FakeI2c, S = FakeSpi, C = FakeClock, R = FakeReset, U = FakeSerial> {
    Mmio(M),
    Gpio(G),
    I2c(I),
    Spi(S),
    Clock(C),
    Reset(R),
    Serial(U),
}
Expand description

Unified enum backend allowing heterogeneous resources to coexist in one proxy instance.

Variants§

§

Mmio(M)

§

Gpio(G)

§

I2c(I)

§

Spi(S)

§

Clock(C)

§

Reset(R)

§

Serial(U)

Implementations§

Source§

impl<M, G, I, S, C, R, U> DeviceBackend<M, G, I, S, C, R, U>

Source

pub fn new_mmio(mmio: M) -> Self

Source

pub fn new_gpio(gpio: G) -> Self

Source

pub fn new_i2c(i2c: I) -> Self

Source

pub fn new_spi(spi: S) -> Self

Source

pub fn new_clock(clock: C) -> Self

Source

pub fn new_reset(reset: R) -> Self

Source

pub fn new_serial(serial: U) -> Self

Trait Implementations§

Source§

impl<M: Clone, G: Clone, I: Clone, S: Clone, C: Clone, R: Clone, U: Clone> Clone for DeviceBackend<M, G, I, S, C, R, U>

Source§

fn clone(&self) -> Self

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<M: Debug, G: Debug, I: Debug, S: Debug, C: Debug, R: Debug, U: Debug> Debug for DeviceBackend<M, G, I, S, C, R, U>

Source§

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

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

impl<M: ResourceBackend, G: ResourceBackend, I: ResourceBackend, S: ResourceBackend, C: ResourceBackend, R: ResourceBackend, U: ResourceBackend> ResourceBackend for DeviceBackend<M, G, I, S, C, R, U>

Source§

fn read32(&mut self, offset: u64) -> Result<u32, BackendError>

Source§

fn write32(&mut self, offset: u64, value: u32) -> Result<(), BackendError>

Source§

fn barrier(&mut self)

Source§

fn gpio_read(&mut self) -> Result<bool, BackendError>

Source§

fn gpio_write(&mut self, value: bool) -> Result<(), BackendError>

Source§

fn i2c_transfer( &mut self, write_data: &[u8], read_length: usize, ) -> Result<Vec<u8>, BackendError>

Source§

fn spi_transmit(&mut self, tx_data: &[u8]) -> Result<Vec<u8>, BackendError>

Source§

fn clock_enable(&mut self) -> Result<(), BackendError>

Source§

fn clock_disable(&mut self) -> Result<(), BackendError>

Source§

fn clock_is_enabled(&mut self) -> Result<bool, BackendError>

Source§

fn clock_set_rate(&mut self, hz: u64) -> Result<(), BackendError>

Source§

fn clock_query_rate(&mut self, hz_in: u64) -> Result<u64, BackendError>

Source§

fn clock_get_rate(&mut self) -> Result<u64, BackendError>

Source§

fn reset_assert(&mut self) -> Result<(), BackendError>

Source§

fn reset_deassert(&mut self) -> Result<(), BackendError>

Source§

fn reset_toggle(&mut self) -> Result<(), BackendError>

Source§

fn reset_status(&mut self) -> Result<bool, BackendError>

Source§

fn serial_read(&mut self) -> Result<Vec<u8>, BackendError>

Source§

fn serial_write(&mut self, data: &[u8]) -> Result<(), BackendError>

Auto Trait Implementations§

§

impl<M, G, I, S, C, R, U> Freeze for DeviceBackend<M, G, I, S, C, R, U>
where M: Freeze, G: Freeze, I: Freeze, S: Freeze, C: Freeze, R: Freeze, U: Freeze,

§

impl<M, G, I, S, C, R, U> RefUnwindSafe for DeviceBackend<M, G, I, S, C, R, U>

§

impl<M, G, I, S, C, R, U> Send for DeviceBackend<M, G, I, S, C, R, U>
where M: Send, G: Send, I: Send, S: Send, C: Send, R: Send, U: Send,

§

impl<M, G, I, S, C, R, U> Sync for DeviceBackend<M, G, I, S, C, R, U>
where M: Sync, G: Sync, I: Sync, S: Sync, C: Sync, R: Sync, U: Sync,

§

impl<M, G, I, S, C, R, U> Unpin for DeviceBackend<M, G, I, S, C, R, U>
where M: Unpin, G: Unpin, I: Unpin, S: Unpin, C: Unpin, R: Unpin, U: Unpin,

§

impl<M, G, I, S, C, R, U> UnsafeUnpin for DeviceBackend<M, G, I, S, C, R, U>

§

impl<M, G, I, S, C, R, U> UnwindSafe for DeviceBackend<M, G, I, S, C, R, U>

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> Same for T

Source§

type Output = T

Should always be Self
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 = !

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

fn try_from(value: U) -> Result<T, !>

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.