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

pub struct Connection {
    pub status: ConnectionStatus,
    pub channels: Channels,
    pub configuration: Configuration,
    // some fields omitted
}

Fields

status: ConnectionStatus

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

channels: Channelsconfiguration: Configuration

Methods

impl Connection[src]

pub fn new() -> Self[src]

creates a Connection object in initial state

pub fn create_channel(&self) -> Result<Channel, Error>[src]

pub fn connect(
    &self,
    credentials: Credentials,
    options: ConnectionProperties
) -> Result<ConnectionState, Error>
[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 send_frame(&self, frame: AMQPFrame)[src]

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

next message to send to the network

returns None if there's no message to send

pub fn serialize(
    &self,
    send_buffer: &mut [u8]
) -> Result<(usize, ConnectionState), Error>
[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(&self, data: &[u8]) -> Result<(usize, ConnectionState), Error>[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(&self, f: AMQPFrame) -> Result<(), Error>[src]

updates the current state with a new received frame

pub fn set_closing(&self)[src]

pub fn set_closed(&self) -> Result<(), Error>[src]

pub fn set_error(&self) -> Result<(), Error>[src]

impl Connection[src]

pub fn run<T: Read + Write>(
    &mut self,
    stream: &mut T,
    send_buffer: &mut Buffer,
    receive_buffer: &mut Buffer
) -> Result<ConnectionState, Error>
[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 Clone for Connection[src]

fn clone_from(&mut self, source: &Self)
1.0.0
[src]

Performs copy-assignment from source. Read more

impl Debug for Connection[src]

Auto Trait Implementations

impl Send for Connection

impl Sync for Connection

Blanket Implementations

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

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]