pub async fn request(&self, message_type: MavMessageType<M>) -> M {
        let (backchannel, mut rx) = mpsc::unbounded();
        self.task_dispatcher
            .clone()
            .send(Task::Subscribe {
                message_type,
                backchannel,
            })
            .await
            .unwrap(); //this may never fail
        rx.next().map(|m| m.expect("Oh no!")).await
    }
/// Awaits the next MavMessage of the given MavMessageType
///
/// # Arguments
///
/// * `message_type` - `MavMessageType` of the desired messages
///
/// # Examples
///
/// ```
/// # use std::time::Duration;
/// # use futures::prelude::*;
/// # use async_mavlink::prelude::*;
/// # use mavlink::{MavlinkVersion, common::MavMessage};
/// # fn main() -> Result<(),AsyncMavlinkError> {
/// # smol::block_on(async {
/// # let (conn, future) = AsyncMavConn::new("udpin:127.0.0.4:14551", MavlinkVersion::V1)?;
/// # smol::spawn(async move { future.await; }).detach();
/// # smol::spawn(async {
/// #   let mut conn = mavlink::connect("udpout:127.0.0.4:14551").unwrap();
/// #   conn.set_protocol_version(mavlink::MavlinkVersion::V1);
/// #   loop {
/// #       let mut header = mavlink::MavHeader::default();
/// #       header.system_id = 0;    
/// #       conn.send(&header, &MavMessage::PARAM_VALUE(Default::default()));
/// #       smol::Timer::after(Duration::from_millis(10)).await;
/// #   }
/// # }).detach();
/// let message_type = MavMessageType::new(&MavMessage::PARAM_VALUE(Default::default()));
///
/// if let MavMessage::PARAM_VALUE(data) = conn.request(message_type).await {
///     // do something with `data`
/// }
/// # Ok(()) })}
/// ```
Awaits the next MavMessage of the given MavMessageType
Awaits the next MavMessage of the given MavMessageType
pub async fn request(&self, message_type: MavMessageType<M>) -> M {
        let (backchannel, mut rx) = mpsc::unbounded();
        self.task_dispatcher
            .clone()
            .send(Task::Subscribe {
                message_type,
                backchannel,
            })
            .await
            .unwrap(); //this may never fail
        rx.next().map(|m| m.expect("Oh no!")).await
    }
pub async fn request ( & self , message_type : MavMessageType < M > ) -> M { let ( backchannel , mut rx ) = mpsc :: unbounded ( ) ; self . task_dispatcher . clone ( ) . send ( Task :: Subscribe { message_type , backchannel , } ) . await . unwrap ( ) ; //this may never fail rx . next ( ) . map ( | m | m . expect ( " " ) ) . await }
Awaits the next MavMessage of the given MavMessageType
Awaits the next MavMessage of the given MavMessageType
&self
message_type
MavMessageType<M>
&self
message_type
MavMessageType<M>
examples
None
use std::time::duration;
None
use futures::prelude::*;
None
use async_mavlink::prelude::*;
None
use mavlink::{mavlinkversion, common::mavmessage};
None
fn main() -> result<(),asyncmavlinkerror> {
None
smol::block_on(async {
None
let (conn, future) = asyncmavconn::new("udpin:127.0.0.4:14551", mavlinkversion::v1)?;
None
smol::spawn(async move { future.await; }).detach();
None
smol::spawn(async {
None
let mut conn = mavlink::connect("udpout:127.0.0.4:14551").unwrap();
None
conn.set_protocol_version(mavlink::mavlinkversion::v1);
None
loop {
None
let mut header = mavlink::mavheader::default();
None
header.system_id = 0;    
None
conn.send(&header, &mavmessage::param_value(default::default()));
None
smol::timer::after(duration::from_millis(10)).await;
None
}
None
}).detach();
let message_type = MavMessageType::new(&MavMessage::PARAM_VALUE(Default::default())).

if let MavMessage::PARAM_VALUE(data) = conn.request(message_type).await {
do something with `data`
}
let message_type = MavMessageType :: new ( &MavMessage :: PARAM_VALUE ( Default :: default () )) . if let MavMessage :: PARAM_VALUE ( data ) = conn . request ( message_type ) . await { do something with ` data ` }
ok(()) })}
None