pub struct Protocol<C> { /* private fields */ }
Expand description
Connection wrapper to process channel requests and responses.
This provides a low-level interface to communicate with the Mercurial command server.
Implementations§
Source§impl<C> Protocol<C>
impl<C> Protocol<C>
Sourcepub fn into_connection(self) -> C
pub fn into_connection(self) -> C
Unwraps the underlying Connection
.
Source§impl<C> Protocol<C>where
C: Connection,
impl<C> Protocol<C>where
C: Connection,
Sourcepub async fn send_command(&mut self, cmd: impl Into<Bytes>) -> Result<()>
pub async fn send_command(&mut self, cmd: impl Into<Bytes>) -> Result<()>
Sends the command of no argument without waiting for response.
This is equivalent to OneShotRequest::start()
of tokio-hglib 0.2.
For MessageLoop::start()
, call this function and fetch responses.
Sourcepub async fn send_command_with_args(
&mut self,
cmd: impl Into<Bytes>,
packed_args: impl Into<Bytes>,
) -> Result<()>
pub async fn send_command_with_args( &mut self, cmd: impl Into<Bytes>, packed_args: impl Into<Bytes>, ) -> Result<()>
Sends the command and arguments without waiting for response.
This is equivalent to OneShotRequest::start_with_args()
of tokio-hglib 0.2.
For MessageLoop::start_with_args()
, call this function and fetch responses.
Sourcepub async fn send_data(&mut self, data: impl Into<Bytes>) -> Result<()>
pub async fn send_data(&mut self, data: impl Into<Bytes>) -> Result<()>
Sends the given data back to the server.
For MessageLoop::resume_with_data()
of tokio-hglib 0.2, call this function
and fetch responses.
Sourcepub async fn query(&mut self, cmd: impl Into<Bytes>) -> Result<Bytes>
pub async fn query(&mut self, cmd: impl Into<Bytes>) -> Result<Bytes>
Sends the command of no argument, and fetches the result data.
This is equivalent to OneShotQuery::start()
of tokio-hglib 0.2.
Sourcepub async fn query_with_args(
&mut self,
cmd: impl Into<Bytes>,
packed_args: impl Into<Bytes>,
) -> Result<Bytes>
pub async fn query_with_args( &mut self, cmd: impl Into<Bytes>, packed_args: impl Into<Bytes>, ) -> Result<Bytes>
Sends the command and arguments, and fetches the result data.
This is equivalent to OneShotQuery::start_with_args()
of tokio-hglib 0.2.
Sourcepub async fn fetch_response(&mut self) -> Result<ChannelMessage>
pub async fn fetch_response(&mut self) -> Result<ChannelMessage>
Fetches response message from the server.
This is equivalent to MessageLoop::resume()
of tokio-hglib 0.2.