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

pub struct Connection {
    pub state: ConnectionState,
    pub channels: HashMap<u16, Channel>,
    pub configuration: Configuration,
    pub vhost: String,
    pub channel_index: u16,
    pub prefetch_size: u32,
    pub prefetch_count: u16,
    pub frame_queue: VecDeque<Frame>,
    pub request_index: RequestId,
    pub finished_reqs: HashMap<RequestId, bool>,
    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 value is true if the request returned something or false otherwise

list of finished basic get requests value is true if the request returned something or false otherwise

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

Methods

impl Connection
[src]

[src]

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

[src]

tests whether we can write to the send buffer

[src]

tests whether we can read from the receive buffer

[src]

tests whether we can parse data from the receive buffer

[src]

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

[src]

read data from the network into the receive buffer

impl Connection
[src]

[src]

creates a Connection object in initial state

[src]

[src]

[src]

[src]

[src]

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

[src]

[src]

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

[src]

returns the channel's state

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

[src]

verifies if the channel is connecyed

[src]

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

[src]

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

[src]

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

[src]

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

[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

[src]

next message to send to the network

returns None if there's no message to send

[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

[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

[src]

updates the current state with a new received frame

[src]

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]

[src]

[src]

[src]

[src]

[src]

[src]

[src]

[src]

[src]

[src]

[src]

[src]

[src]

[src]

[src]

[src]

[src]

[src]

[src]

[src]

[src]

[src]

[src]

[src]

[src]

[src]

[src]

[src]

[src]

[src]

[src]

[src]

[src]

[src]

[src]

[src]

[src]

[src]

[src]

[src]

[src]

[src]

[src]

[src]

[src]

[src]

[src]

[src]

[src]

[src]

[src]

[src]

[src]

Trait Implementations

impl Clone for Connection
[src]

[src]

Returns a copy of the value. Read more

1.0.0
[src]

Performs copy-assignment from source. Read more

impl Debug for Connection
[src]

[src]

Formats the value using the given formatter. Read more

impl PartialEq for Connection
[src]

[src]

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

[src]

This method tests for !=.

Auto Trait Implementations

impl Send for Connection

impl Sync for Connection