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

pub struct Connection {
    pub state: ConnectionState,
    pub channels: HashMap<u16, Channel>,
    pub configuration: Configuration,
    pub channel_index: u16,
    pub prefetch_size: u32,
    pub prefetch_count: u16,
    pub frame_queue: VecDeque<Frame>,
    pub request_index: RequestId,
    pub finished_reqs: HashSet<RequestId>,
    pub finished_get_reqs: HashMap<RequestId, bool>,
    pub credentials: Option<Credentials>,
}

Fields

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

list of message to send

next request id

list of finished requests

list of finished basic get requests

credentials are stored in an option to remove them from memory once they are used

Methods

impl Connection
[src]

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

tests whether we can write to the send buffer

tests whether we can read from the receive buffer

tests whether we can parse data from the receive buffer

serializes frames to the send buffer then to the writer (if possible)

read data from the network into the receive buffer

impl Connection
[src]

creates a Connection object in initial state

creates a Channel object in initial state

returns a u16 channel id

The channel will not be usable until channel_open is called with the channel id

verifies if the channel's state is the one passed as argument

returns a Option of the result. None in the case the channel does not exists

returns the channel's state

returns a Option of the state. Non in the case the channel does not exists

verifies if the channel is connecyed

verifies if the request identified with the RequestId is finished

this method can only be called once per request id, as it will be removed from the list afterwards

verifies if the get request identified with the RequestId is finished

this method can only be called once per request id, as it will be removed from the list afterwards

gets the next message corresponding to a channel, queue and consumer tag

if the channel id, queue and consumer tag have no link, the method will return None. If there is no message, the method will return None

gets the next message corresponding to a channel and queue, in response to a basic.get

if the channel id and queue have no link, the method will return None. If there is no message, the method will return None

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

next message to send to the network

returns None if there's no message to send

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

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

updates the current state with a new received frame

generates the content header and content frames for a payload

the frames will be stored in the frame queue until they're written to the network.

impl Connection
[src]

Trait Implementations

impl Clone for Connection
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl Debug for Connection
[src]

Formats the value using the given formatter.

impl PartialEq for Connection
[src]

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.