diff --git a/Cargo.toml b/Cargo.toml index 7723dbe..e31da07 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "ssip-client" -version = "0.5.0" +version = "0.5.1" authors = ["Laurent Pelecq "] edition = "2018" description = "Client API for Speech Dispatcher" diff --git a/src/async_mio.rs b/src/async_mio.rs index 35c00dd..eca6ffb 100644 --- a/src/async_mio.rs +++ b/src/async_mio.rs @@ -7,15 +7,28 @@ // option. All files in the project carrying such notice may not be copied, // modified, or distributed except according to those terms. -use mio::event::Source; use std::collections::VecDeque; use std::io::{self, Read, Write}; use crate::{ - client::{Client, Request, Response}, + client::{Client, Request, Response, Source}, types::*, }; +// Hack to generate the doc. There must be a better way. +#[cfg(all(not(feature = "async-mio"), doc))] +mod mio { + /// Polls for readiness events on all registered values. + /// + /// See [`mio::Poll`](https://docs.rs/mio/latest/mio/struct.Poll.html#) + pub struct Poll {} + + /// Source identifier. + /// + /// See [`mio::Token`](https://docs.rs/mio/latest/mio/struct.Token.html#). + pub struct Token(pub usize); +} + const INITIAL_REQUEST_QUEUE_CAPACITY: usize = 4; /// Asynchronous client based on `mio`. diff --git a/src/client.rs b/src/client.rs index fdf6938..b5f3de3 100644 --- a/src/client.rs +++ b/src/client.rs @@ -17,10 +17,10 @@ use crate::types::*; // Trick to have common implementation for std and mio streams.. #[cfg(not(feature = "async-mio"))] -use std::fmt::Debug as Source; +pub(crate) use std::fmt::Debug as Source; #[cfg(feature = "async-mio")] -use mio::event::Source; +pub(crate) use mio::event::Source; /// Convert boolean to ON or OFF fn on_off(value: bool) -> &'static str { @@ -165,8 +165,8 @@ macro_rules! send_range { /// SSIP client on generic stream /// /// There are two ways to send requests and receive responses: -/// * Either with the generic [`send`] and [`receive`] -/// * Or with the specific methods such as [`set_rate`], ..., [`get_rate`], ... +/// * Either with the generic [`Client::send`] and [`Client::receive`] +/// * Or with the specific methods such as [`Client::set_rate`], ..., [`Client::get_rate`], ... pub struct Client { input: io::BufReader, output: io::BufWriter, diff --git a/src/lib.rs b/src/lib.rs index 3fa3117..9436be7 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -45,5 +45,5 @@ pub use types::*; #[cfg(any(feature = "async-mio", doc))] mod async_mio; -#[cfg(feature = "async-mio")] +#[cfg(any(feature = "async-mio", doc))] pub use async_mio::AsyncClient;