AsyncChip

Struct AsyncChip 

Source
pub struct AsyncChip(/* private fields */);
Expand description

Async wrapper around Chip for the tokio reactor.

§Example

use gpiocdev::Chip;
use gpiocdev::tokio::AsyncChip;

let chip = Chip::from_path("/dev/gpiochip0")?;
let achip = AsyncChip::new(chip);
let evt = achip.read_line_info_change_event().await?;

Implementations§

Source§

impl AsyncChip

Source

pub fn new(chip: Chip) -> Self

Create a Tokio wrapper for a Chip.

Source

pub async fn read_line_info_change_event(&self) -> Result<InfoChangeEvent>

Async form of Chip::read_line_info_change_event.

§Example
use gpiocdev::tokio::AsyncChip;

let chip = Chip::from_path("/dev/gpiochip0")?;
let achip = AsyncChip::new(chip);
let evt = achip.read_line_info_change_event().await?;
Source

pub fn info_change_events(&self) -> InfoChangeStream<'_>

Async form of Chip::info_change_events.

§Example
use gpiocdev::tokio::AsyncChip;
use tokio_stream::StreamExt;

let chip = Chip::from_path("/dev/gpiochip0")?;
let achip = AsyncChip::new(chip);
let mut events = achip.info_change_events();
while let Ok(evt) = events.next().await.unwrap() {
    // process event...
}

Trait Implementations§

Source§

impl AsRef<Chip> for AsyncChip

Source§

fn as_ref(&self) -> &Chip

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl Debug for AsyncChip

Source§

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

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

impl From<AsyncChip> for Chip

Source§

fn from(c: AsyncChip) -> Chip

Converts to this type from the input type.
Source§

impl From<Chip> for AsyncChip

Source§

fn from(c: Chip) -> AsyncChip

Converts to this type from the input type.

Auto Trait Implementations§

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.