pub struct Connection {
Show 14 fields pub state: ConnectionState, pub channels: HashMap<u16, Channel>, pub configuration: Configuration, pub vhost: String, pub channel_index: u16, pub channel_id_lock: Arc<Mutex<()>>, pub prefetch_size: u32, pub prefetch_count: u16, pub frame_queue: VecDeque<AMQPFrame>, pub request_index: RequestId, pub finished_reqs: HashMap<RequestId, bool>, pub finished_get_reqs: HashMap<RequestId, bool>, pub generated_names: HashMap<RequestId, String>, pub credentials: Option<Credentials>,
}

Fields

state: ConnectionState

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

channels: HashMap<u16, Channel>configuration: Configurationvhost: Stringchannel_index: u16channel_id_lock: Arc<Mutex<()>>prefetch_size: u32prefetch_count: u16frame_queue: VecDeque<AMQPFrame>

list of message to send

request_index: RequestId

next request id

finished_reqs: HashMap<RequestId, bool>

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

finished_get_reqs: HashMap<RequestId, bool>

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

generated_names: HashMap<RequestId, String>

list of generated names (e.g. when supplying empty string for consumer tag or queue name)

credentials: Option<Credentials>

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

Implementations

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

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

Get the name generated by the server for a given RequestId

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

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 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.

Trait Implementations

Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.