Struct intel_spi::SpiDev

source ·
pub struct SpiDev<'m, M: Mapper> {
    pub regs: &'m mut SpiRegs,
    /* private fields */
}

Fields§

§regs: &'m mut SpiRegs

Implementations§

source§

impl<'m, M: Mapper> SpiDev<'m, M>

source

pub unsafe fn new(mcfg: &[u8], mapper: &'m mut M) -> Result<Self, &'static str>

Examples found in repository?
examples/util/mod.rs (line 54)
51
52
53
54
55
pub unsafe fn get_spi() -> SpiDev<'static, LinuxMapper> {
    static mut LINUX_MAPPER: LinuxMapper = LinuxMapper;
    let mcfg = fs::read("/sys/firmware/acpi/tables/MCFG").expect("failed to read MCFG");
    SpiDev::new(&mcfg, &mut LINUX_MAPPER).expect("failed to get SPI device")
}

Trait Implementations§

source§

impl<'m, M: Mapper> Drop for SpiDev<'m, M>

source§

fn drop(&mut self)

Executes the destructor for this type. Read more
source§

impl<'m, M: Mapper> Spi for SpiDev<'m, M>

source§

fn len(&mut self) -> Result<usize, SpiError>

source§

fn read(&mut self, address: usize, buf: &mut [u8]) -> Result<usize, SpiError>

source§

fn erase(&mut self, address: usize) -> Result<(), SpiError>

source§

fn write(&mut self, address: usize, buf: &[u8]) -> Result<usize, SpiError>

Auto Trait Implementations§

§

impl<'m, M> RefUnwindSafe for SpiDev<'m, M>
where M: RefUnwindSafe,

§

impl<'m, M> Send for SpiDev<'m, M>
where M: Send,

§

impl<'m, M> Sync for SpiDev<'m, M>
where M: Sync,

§

impl<'m, M> Unpin for SpiDev<'m, M>

§

impl<'m, M> !UnwindSafe for SpiDev<'m, M>

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> 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, U> TryFrom<U> for T
where U: Into<T>,

§

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>,

§

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.