[][src]Struct tokio_hglib::Protocol

pub struct Protocol<C> { /* fields omitted */ }

Connection wrapper to process channel requests and responses.

This provides a low-level interface to communicate with the Mercurial command server.

Implementations

impl<C> Protocol<C>[src]

pub fn new(conn: C) -> Self[src]

Creates a new Protocol that wraps the given connection.

pub fn into_connection(self) -> C[src]

Unwraps the underlying Connection.

impl<C> Protocol<C> where
    C: Connection
[src]

pub async fn send_command(&mut self, cmd: impl Into<Bytes>) -> Result<()>[src]

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.

pub async fn send_command_with_args(
    &mut self,
    cmd: impl Into<Bytes>,
    packed_args: impl Into<Bytes>
) -> Result<()>
[src]

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.

pub async fn send_data(&mut self, data: impl Into<Bytes>) -> Result<()>[src]

Sends the given data back to the server.

For MessageLoop::resume_with_data() of tokio-hglib 0.2, call this function and fetch responses.

pub async fn query(&mut self, cmd: impl Into<Bytes>) -> Result<Bytes>[src]

Sends the command of no argument, and fetches the result data.

This is equivalent to OneShotQuery::start() of tokio-hglib 0.2.

pub async fn query_with_args(
    &mut self,
    cmd: impl Into<Bytes>,
    packed_args: impl Into<Bytes>
) -> Result<Bytes>
[src]

Sends the command and arguments, and fetches the result data.

This is equivalent to OneShotQuery::start_with_args() of tokio-hglib 0.2.

pub async fn fetch_response(&mut self) -> Result<ChannelMessage>[src]

Fetches response message from the server.

This is equivalent to MessageLoop::resume() of tokio-hglib 0.2.

Trait Implementations

impl<C> AsRawFd for Protocol<C> where
    C: AsRawFd
[src]

impl<C: Debug> Debug for Protocol<C>[src]

Auto Trait Implementations

impl<C> RefUnwindSafe for Protocol<C> where
    C: RefUnwindSafe
[src]

impl<C> Send for Protocol<C> where
    C: Send
[src]

impl<C> Sync for Protocol<C> where
    C: Sync
[src]

impl<C> Unpin for Protocol<C> where
    C: Unpin
[src]

impl<C> UnwindSafe for Protocol<C> where
    C: UnwindSafe
[src]

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.