Skip to content

Commit 38e85b6

Browse files
pv42patrickelectric
authored andcommitted
doc: replace block with yield, move file comment, fmt cargo
1 parent 68536ef commit 38e85b6

File tree

6 files changed

+10
-9
lines changed

6 files changed

+10
-9
lines changed

mavlink-core/Cargo.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ embedded-io-async = { version = "0.6.1", optional = true }
2626
serde = { version = "1.0.115", optional = true, features = ["derive"] }
2727
serde_arrays = { version = "0.1.0", optional = true }
2828
serial = { version = "0.4", optional = true }
29-
tokio = { version = "1.0", default-features = false, features = ["io-util", "net", "sync", "fs", ], optional = true }
29+
tokio = { version = "1.0", default-features = false, features = ["io-util", "net", "sync", "fs"], optional = true }
3030
sha2 = { version = "0.10", optional = true }
3131
async-trait = { version = "0.1.18", optional = true }
3232

@@ -46,4 +46,4 @@ async-trait = { version = "0.1.18", optional = true }
4646
default = ["std", "tcp", "udp", "direct-serial", "serde"]
4747

4848
[dev-dependencies]
49-
tokio = { version = "1.0", default-features = false, features = ["io-util", "net", "sync", "fs","macros", "rt" ] }
49+
tokio = { version = "1.0", default-features = false, features = ["io-util", "net", "sync", "fs", "macros", "rt"] }

mavlink-core/src/async_connection/file.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
//! Async File MAVLINK connection
2+
13
use core::ops::DerefMut;
24

35
use super::AsyncMavConnection;
@@ -15,8 +17,6 @@ use crate::read_versioned_msg_async;
1517
#[cfg(feature = "signing")]
1618
use crate::{read_versioned_msg_async_signed, SigningConfig, SigningData};
1719

18-
/// File MAVLINK connection
19-
2020
pub async fn open(file_path: &str) -> io::Result<AsyncFileConnection> {
2121
let file = File::open(file_path).await?;
2222
Ok(AsyncFileConnection {

mavlink-core/src/async_connection/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ use crate::SigningConfig;
1818
pub trait AsyncMavConnection<M: Message + Sync + Send> {
1919
/// Receive a mavlink message.
2020
///
21-
/// Wait until a valid frame is received, ignoring invalid messages.
21+
/// Yield until a valid frame is received, ignoring invalid messages.
2222
async fn recv(&self) -> Result<(MavHeader, M), crate::error::MessageReadError>;
2323

2424
/// Send a mavlink message

mavlink-core/src/async_connection/tcp.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
//! Async TCP MAVLink connection
2+
13
use super::{get_socket_addr, AsyncMavConnection};
24
use crate::async_peek_reader::AsyncPeekReader;
35
use crate::{MavHeader, MavlinkVersion, Message};
@@ -15,8 +17,6 @@ use crate::{
1517
read_versioned_msg_async_signed, write_versioned_msg_async_signed, SigningConfig, SigningData,
1618
};
1719

18-
/// TCP MAVLink connection
19-
2020
pub async fn select_protocol<M: Message + Sync + Send>(
2121
address: &str,
2222
) -> io::Result<Box<dyn AsyncMavConnection<M> + Sync + Send>> {
@@ -57,7 +57,7 @@ pub async fn tcpin<T: std::net::ToSocketAddrs>(address: T) -> io::Result<TcpConn
5757
let addr = get_socket_addr(address)?;
5858
let listener = TcpListener::bind(addr).await?;
5959

60-
//For now we only accept one incoming stream: this blocks until we get one
60+
//For now we only accept one incoming stream: this yields until we get one
6161
match listener.accept().await {
6262
Ok((socket, _)) => {
6363
let (reader, writer) = socket.into_split();

mavlink-core/src/async_connection/udp.rs

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
//! Async UDP MAVLink connection
2+
13
use core::{ops::DerefMut, task::Poll};
24
use std::{collections::VecDeque, io::Read, sync::Arc};
35

mavlink-core/src/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -958,7 +958,6 @@ fn read_v2_raw_message_inner<M: Message, R: Read>(
958958
}
959959

960960
/// Async read a raw buffer with the mavlink message
961-
///
962961
/// V2 maximum size is 280 bytes: `<https://mavlink.io/en/guide/serialization.html>`
963962
#[cfg(feature = "tokio-1")]
964963
pub async fn read_v2_raw_message_async<M: Message, R: tokio::io::AsyncReadExt + Unpin>(

0 commit comments

Comments
 (0)