Trait mpdpopm::clients::RequestResponse [−][src]
pub trait RequestResponse {
fn req<'life0, 'life1, 'async_trait>(
&'life0 mut self,
msg: &'life1 str
) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>>
where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait;
fn req_w_hint<'life0, 'life1, 'async_trait>(
&'life0 mut self,
msg: &'life1 str,
hint: usize
) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>>
where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait;
}
Expand description
Represents a simple, textual request/response protocol like that employed by mpd
.
This trait also enables unit testing client implementations. Note that it is async.
Required methods
fn req<'life0, 'life1, 'async_trait>(
&'life0 mut self,
msg: &'life1 str
) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
The hint is used to size the buffer prior to reading the response
Implementors
MpdConnection implements RequestResponse using the usual (async) socket I/O
The callers need not include the trailing newline in their requests; the implementation will append it.