[][src]Struct async_resol_vbus::TcpClientHandshake

pub struct TcpClientHandshake { /* fields omitted */ }

Handles the client-side of the VBus-over-TCP handshake.

Examples

use async_std::net::{SocketAddr, TcpStream};

use async_resol_vbus::TcpClientHandshake;

let address = "192.168.5.217:7053".parse::<SocketAddr>()?;
let stream = TcpStream::connect(address).await?;
let mut hs = TcpClientHandshake::start(stream).await?;
hs.send_pass_command("vbus").await?;
let stream = hs.send_data_command().await?;
// ...

Methods

impl TcpClientHandshake[src]

pub async fn start(stream: TcpStream) -> Result<TcpClientHandshake>[src]

Start the handshake by waiting for the initial greeting reply from the service.

pub fn into_inner(self) -> TcpStream[src]

Consume self and return the underlying TcpStream.

pub async fn send_connect_command<'_, '_>(
    &'_ mut self,
    via_tag: &'_ str
) -> Result<()>
[src]

Send the CONNECT command and wait for the reply.

pub async fn send_pass_command<'_, '_>(
    &'_ mut self,
    password: &'_ str
) -> Result<()>
[src]

Send the PASS command and wait for the reply.

pub async fn send_channel_command<'_>(&'_ mut self, channel: u8) -> Result<()>[src]

Send the CHANNEL command and wait for the reply.

pub async fn send_data_command(__arg0: Self) -> Result<TcpStream>[src]

Send the DATA command and wait for the reply.

This function returns the underlying TcpStream since the handshake is complete after sending this command.

pub async fn send_quit_command(__arg0: Self) -> Result<()>[src]

Send the QUIT command and wait for the reply.

Trait Implementations

impl Debug for TcpClientHandshake[src]

Auto Trait Implementations

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.