Struct ContextWrapper

Source
pub struct ContextWrapper<'a, T, C> { /* private fields */ }
Expand description

Context wrapper, to bind an API with a context.

Implementations§

Source§

impl<'a, T, C> ContextWrapper<'a, T, C>

Source

pub fn new(api: &'a T, context: C) -> ContextWrapper<'a, T, C>

Create a new ContextWrapper, binding the API and context.

Source

pub fn api(&self) -> &T

Borrows the API.

Source

pub fn context(&self) -> &C

Borrows the context.

Trait Implementations§

Source§

impl<'a, T: Api<C>, C> ApiNoContext for ContextWrapper<'a, T, C>

Source§

fn i2c_bus_api( &self, ) -> Box<dyn Future<Item = I2cBusApiResponse, Error = ApiError> + Send>

Source§

fn i2c_bus_list( &self, ) -> Box<dyn Future<Item = I2cBusListResponse, Error = ApiError> + Send>

Source§

fn i2c_bus_read_byte( &self, bus_id: i32, addr: i32, ) -> Box<dyn Future<Item = I2cBusReadByteResponse, Error = ApiError> + Send>

Source§

fn i2c_bus_read_bytes( &self, bus_id: i32, addr: i32, num_bytes: i32, ) -> Box<dyn Future<Item = I2cBusReadBytesResponse, Error = ApiError> + Send>

Source§

fn i2c_bus_read_reg( &self, bus_id: i32, addr: i32, reg: i32, num_bytes: i32, ) -> Box<dyn Future<Item = I2cBusReadRegResponse, Error = ApiError> + Send>

Source§

fn i2c_bus_write_byte( &self, bus_id: i32, addr: i32, value: i32, ) -> Box<dyn Future<Item = I2cBusWriteByteResponse, Error = ApiError> + Send>

Source§

fn i2c_bus_write_byte_reg( &self, bus_id: i32, addr: i32, reg: i32, value: i32, ) -> Box<dyn Future<Item = I2cBusWriteByteRegResponse, Error = ApiError> + Send>

Source§

fn i2c_bus_write_bytes( &self, bus_id: i32, addr: i32, values: Values, ) -> Box<dyn Future<Item = I2cBusWriteBytesResponse, Error = ApiError> + Send>

Source§

fn i2c_bus_write_bytes_reg( &self, bus_id: i32, addr: i32, reg: i32, values: Values, ) -> Box<dyn Future<Item = I2cBusWriteBytesRegResponse, Error = ApiError> + Send>

Source§

impl<'a, T, C> Clone for ContextWrapper<'a, T, C>
where C: Clone,

Source§

fn clone(&self) -> ContextWrapper<'a, T, C>

Returns a copy of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl<'a, T, C> Debug for ContextWrapper<'a, T, C>
where T: Debug, C: Debug,

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'a, T, C> Freeze for ContextWrapper<'a, T, C>
where C: Freeze,

§

impl<'a, T, C> RefUnwindSafe for ContextWrapper<'a, T, C>

§

impl<'a, T, C> Send for ContextWrapper<'a, T, C>
where C: Send, T: Sync,

§

impl<'a, T, C> Sync for ContextWrapper<'a, T, C>
where C: Sync, T: Sync,

§

impl<'a, T, C> Unpin for ContextWrapper<'a, T, C>
where C: Unpin,

§

impl<'a, T, C> UnwindSafe for ContextWrapper<'a, T, C>

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

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
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.