Trait radio::nonblocking::AsyncTransmit

source ·
pub trait AsyncTransmit<'a, E> {
    type Output: Future<Output = Result<(), AsyncError<E>>>;

    // Required method
    fn async_transmit(
        &'a mut self,
        data: &'a [u8],
        tx_options: AsyncOptions
    ) -> Result<Self::Output, E>;
}
Expand description

Async transmit function implemented over radio::Transmit and radio::Power using the provided AsyncOptions

extern crate async_std;
use async_std::task;

use radio::nonblocking::{AsyncTransmit, AsyncOptions};

let res = task::block_on(async {
    // Transmit using a future
    radio.async_transmit(&[0xaa, 0xbb], AsyncOptions::default())?.await
});

assert_eq!(res, Ok(()));

AsyncTransmit function provides an async implementation for transmitting packets

Required Associated Types§

source

type Output: Future<Output = Result<(), AsyncError<E>>>

Required Methods§

source

fn async_transmit( &'a mut self, data: &'a [u8], tx_options: AsyncOptions ) -> Result<Self::Output, E>

Implementors§

source§

impl<'a, T, E> AsyncTransmit<'a, E> for T
where T: Transmit<Error = E> + Power<Error = E> + 'a, E: Debug + Unpin,

AsyncTransmit object for all Transmit devices

§

type Output = TransmitFuture<'a, T, E>