[][src]Struct lapin_async::connection::Connection

pub struct Connection {
    pub state: ConnectionState,
    pub channels: Channels,
    pub configuration: Configuration,
    pub vhost: String,
    // some fields omitted
}

Fields

state: ConnectionState

current state of the connection. In normal use it should always be ConnectionState::Connected

channels: Channelsconfiguration: Configurationvhost: String

Methods

impl Connection[src]

pub fn new() -> Self[src]

creates a Connection object in initial state

pub fn set_credentials(&mut self, username: &str, password: &str)[src]

pub fn set_vhost(&mut self, vhost: &str)[src]

pub fn connect(
    &mut self,
    options: ConnectionProperties
) -> Result<ConnectionState>
[src]

starts the process of connecting to the server

this will set up the state machine and generates the required messages. The messages will not be sent until calls to serialize to write the messages to a buffer, or calls to next_frame to obtain the next message to send

pub fn next_frame(&mut self) -> Option<AMQPFrame>[src]

next message to send to the network

returns None if there's no message to send

pub fn serialize(
    &mut self,
    send_buffer: &mut [u8]
) -> Result<(usize, ConnectionState)>
[src]

writes the next message to a mutable byte slice

returns how many bytes were written and the current state. this method can be called repeatedly until the buffer is full or there are no more frames to send

pub fn parse(&mut self, data: &[u8]) -> Result<(usize, ConnectionState)>[src]

parses a frame from a byte slice

returns how many bytes were consumed and the current state.

This method will update the state machine according to the ReceivedStart frame with handle_frame

pub fn handle_frame(&mut self, f: AMQPFrame) -> Result<(), Error>[src]

updates the current state with a new received frame

impl Connection[src]

pub fn run<T: Read + Write>(
    &mut self,
    stream: &mut T,
    send_buffer: &mut Buffer,
    receive_buffer: &mut Buffer
) -> Result<ConnectionState>
[src]

helper function to handle reading and writing repeatedly from the network until there's no more state to update

Trait Implementations

impl Default for Connection[src]

impl Debug for Connection[src]

Auto Trait Implementations

impl Send for Connection

impl Sync for Connection

Blanket Implementations

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.

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

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

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