pub struct Chain<'c, S: Socket, ReplyParams, ReplyError> { /* private fields */ }Expand description
A chain of method calls that will be sent together.
Each call must have the same method, reply, and error types for homogeneity. Use
Connection::chain_call to create a new chain, extend it with Chain::append and send the
the entire chain using Chain::send.
With std feature enabled, this supports unlimited calls. Otherwise it is limited by how many
calls can fit in our fixed-sized buffer.
Oneway calls (where Call::oneway() == Some(true)) do not expect replies and are handled
automatically by the chain.
Implementations§
Source§impl<'c, S, ReplyParams, ReplyError> Chain<'c, S, ReplyParams, ReplyError>
impl<'c, S, ReplyParams, ReplyError> Chain<'c, S, ReplyParams, ReplyError>
Sourcepub fn append<Method>(
self,
call: &Call<Method>,
fds: Vec<OwnedFd>,
) -> Result<Self>
pub fn append<Method>( self, call: &Call<Method>, fds: Vec<OwnedFd>, ) -> Result<Self>
Append another method call to the chain.
The call will be enqueued but not sent until Chain::send is called. Note that one way
calls (where Call::oneway() == Some(true)) do not receive replies.
Calls with more == Some(true) will stream multiple replies until a reply with
continues != Some(true) is received.
In std mode, the fds parameter contains file descriptors to send along with the call.
Sourcepub async fn send(
self,
) -> Result<impl Stream<Item = Result<(Result<ReplyParams, ReplyError>, Vec<OwnedFd>)>> + 'c>where
ReplyParams: 'c,
ReplyError: 'c,
pub async fn send(
self,
) -> Result<impl Stream<Item = Result<(Result<ReplyParams, ReplyError>, Vec<OwnedFd>)>> + 'c>where
ReplyParams: 'c,
ReplyError: 'c,
Send all enqueued calls and return a replies stream.
This will flush all enqueued calls in a single write operation and then return a stream that allows reading the replies.
In std mode, each reply includes any file descriptors received.