Skip to main content

InitError

Struct InitError 

Source
#[non_exhaustive]
pub struct InitError<I2C: I2c, D = NoDelay> { pub error: Error<I2C::Error>, pub i2c: I2C, pub delay: D, }
Expand description

Initialization failure that returns the I2C bus and delay backend to the caller.

When Tmag5273::init fails, the bus is not consumed. InitError bundles the Error with the original I2C peripheral and delay backend so the caller can retry or use them for another device.

Fields (Non-exhaustive)§

This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§error: Error<I2C::Error>

The error that caused initialization to fail.

§i2c: I2C

The I2C bus, returned so the caller can reuse it.

§delay: D

The delay backend, returned so the caller can reuse it.

Trait Implementations§

Source§

impl<I2C: I2c, D> Debug for InitError<I2C, D>
where I2C::Error: Debug,

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<I2C, D> Freeze for InitError<I2C, D>
where I2C: Freeze, D: Freeze, <I2C as ErrorType>::Error: Freeze,

§

impl<I2C, D> RefUnwindSafe for InitError<I2C, D>

§

impl<I2C, D> Send for InitError<I2C, D>
where I2C: Send, D: Send, <I2C as ErrorType>::Error: Send,

§

impl<I2C, D> Sync for InitError<I2C, D>
where I2C: Sync, D: Sync, <I2C as ErrorType>::Error: Sync,

§

impl<I2C, D> Unpin for InitError<I2C, D>
where I2C: Unpin, D: Unpin, <I2C as ErrorType>::Error: Unpin,

§

impl<I2C, D> UnsafeUnpin for InitError<I2C, D>
where I2C: UnsafeUnpin, D: UnsafeUnpin, <I2C as ErrorType>::Error: UnsafeUnpin,

§

impl<I2C, D> UnwindSafe for InitError<I2C, D>
where I2C: UnwindSafe, D: UnwindSafe, <I2C as ErrorType>::Error: UnwindSafe,

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

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.