[−][src]Struct lapin_async::connection::Connection
Fields
state: ConnectionState
current state of the connection. In normal use it should always be ConnectionState::Connected
channels: HashMap<u16, Channel>
configuration: Configuration
vhost: String
channel_index: u16
channel_id_lock: Arc<Mutex<()>>
prefetch_size: u32
prefetch_count: u16
frame_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
Methods
impl Connection
[src]
pub fn receive_method(
&mut self,
channel_id: u16,
method: AMQPClass
) -> Result<(), Error>
[src]
&mut self,
channel_id: u16,
method: AMQPClass
) -> Result<(), Error>
pub fn channel_open(
&mut self,
_channel_id: u16,
out_of_band: ShortString
) -> Result<RequestId, Error>
[src]
&mut self,
_channel_id: u16,
out_of_band: ShortString
) -> Result<RequestId, Error>
pub fn receive_channel_open_ok(
&mut self,
_channel_id: u16,
_: OpenOk
) -> Result<(), Error>
[src]
&mut self,
_channel_id: u16,
_: OpenOk
) -> Result<(), Error>
pub fn channel_flow(
&mut self,
_channel_id: u16,
active: Boolean
) -> Result<RequestId, Error>
[src]
&mut self,
_channel_id: u16,
active: Boolean
) -> Result<RequestId, Error>
pub fn receive_channel_flow(
&mut self,
_channel_id: u16,
method: Flow
) -> Result<(), Error>
[src]
&mut self,
_channel_id: u16,
method: Flow
) -> Result<(), Error>
pub fn channel_flow_ok(
&mut self,
_channel_id: u16,
active: Boolean
) -> Result<(), Error>
[src]
&mut self,
_channel_id: u16,
active: Boolean
) -> Result<(), Error>
pub fn receive_channel_flow_ok(
&mut self,
_channel_id: u16,
method: FlowOk
) -> Result<(), Error>
[src]
&mut self,
_channel_id: u16,
method: FlowOk
) -> Result<(), Error>
pub fn channel_close(
&mut self,
_channel_id: u16,
reply_code: ShortUInt,
reply_text: ShortString,
class_id: ShortUInt,
method_id: ShortUInt
) -> Result<RequestId, Error>
[src]
&mut self,
_channel_id: u16,
reply_code: ShortUInt,
reply_text: ShortString,
class_id: ShortUInt,
method_id: ShortUInt
) -> Result<RequestId, Error>
pub fn receive_channel_close(
&mut self,
_channel_id: u16,
_: Close
) -> Result<(), Error>
[src]
&mut self,
_channel_id: u16,
_: Close
) -> Result<(), Error>
pub fn channel_close_ok(&mut self, _channel_id: u16) -> Result<(), Error>
[src]
pub fn receive_channel_close_ok(
&mut self,
_channel_id: u16,
_: CloseOk
) -> Result<(), Error>
[src]
&mut self,
_channel_id: u16,
_: CloseOk
) -> Result<(), Error>
pub fn access_request(
&mut self,
_channel_id: u16,
realm: ShortString,
exclusive: Boolean,
passive: Boolean,
active: Boolean,
write: Boolean,
read: Boolean
) -> Result<RequestId, Error>
[src]
&mut self,
_channel_id: u16,
realm: ShortString,
exclusive: Boolean,
passive: Boolean,
active: Boolean,
write: Boolean,
read: Boolean
) -> Result<RequestId, Error>
pub fn receive_access_request_ok(
&mut self,
_channel_id: u16,
_: RequestOk
) -> Result<(), Error>
[src]
&mut self,
_channel_id: u16,
_: RequestOk
) -> Result<(), Error>
pub fn exchange_declare(
&mut self,
_channel_id: u16,
ticket: ShortUInt,
exchange: ShortString,
exchange_type: ShortString,
passive: Boolean,
durable: Boolean,
auto_delete: Boolean,
internal: Boolean,
nowait: Boolean,
arguments: FieldTable
) -> Result<RequestId, Error>
[src]
&mut self,
_channel_id: u16,
ticket: ShortUInt,
exchange: ShortString,
exchange_type: ShortString,
passive: Boolean,
durable: Boolean,
auto_delete: Boolean,
internal: Boolean,
nowait: Boolean,
arguments: FieldTable
) -> Result<RequestId, Error>
pub fn receive_exchange_declare_ok(
&mut self,
_channel_id: u16,
_: DeclareOk
) -> Result<(), Error>
[src]
&mut self,
_channel_id: u16,
_: DeclareOk
) -> Result<(), Error>
pub fn exchange_delete(
&mut self,
_channel_id: u16,
ticket: ShortUInt,
exchange: ShortString,
if_unused: Boolean,
nowait: Boolean
) -> Result<RequestId, Error>
[src]
&mut self,
_channel_id: u16,
ticket: ShortUInt,
exchange: ShortString,
if_unused: Boolean,
nowait: Boolean
) -> Result<RequestId, Error>
pub fn receive_exchange_delete_ok(
&mut self,
_channel_id: u16,
_: DeleteOk
) -> Result<(), Error>
[src]
&mut self,
_channel_id: u16,
_: DeleteOk
) -> Result<(), Error>
pub fn exchange_bind(
&mut self,
_channel_id: u16,
ticket: ShortUInt,
destination: ShortString,
source: ShortString,
routing_key: ShortString,
nowait: Boolean,
arguments: FieldTable
) -> Result<RequestId, Error>
[src]
&mut self,
_channel_id: u16,
ticket: ShortUInt,
destination: ShortString,
source: ShortString,
routing_key: ShortString,
nowait: Boolean,
arguments: FieldTable
) -> Result<RequestId, Error>
pub fn receive_exchange_bind_ok(
&mut self,
_channel_id: u16,
_: BindOk
) -> Result<(), Error>
[src]
&mut self,
_channel_id: u16,
_: BindOk
) -> Result<(), Error>
pub fn exchange_unbind(
&mut self,
_channel_id: u16,
ticket: ShortUInt,
destination: ShortString,
source: ShortString,
routing_key: ShortString,
nowait: Boolean,
arguments: FieldTable
) -> Result<RequestId, Error>
[src]
&mut self,
_channel_id: u16,
ticket: ShortUInt,
destination: ShortString,
source: ShortString,
routing_key: ShortString,
nowait: Boolean,
arguments: FieldTable
) -> Result<RequestId, Error>
pub fn receive_exchange_unbind_ok(
&mut self,
_channel_id: u16,
_: UnbindOk
) -> Result<(), Error>
[src]
&mut self,
_channel_id: u16,
_: UnbindOk
) -> Result<(), Error>
pub fn queue_declare(
&mut self,
_channel_id: u16,
ticket: ShortUInt,
queue: ShortString,
passive: Boolean,
durable: Boolean,
exclusive: Boolean,
auto_delete: Boolean,
nowait: Boolean,
arguments: FieldTable
) -> Result<RequestId, Error>
[src]
&mut self,
_channel_id: u16,
ticket: ShortUInt,
queue: ShortString,
passive: Boolean,
durable: Boolean,
exclusive: Boolean,
auto_delete: Boolean,
nowait: Boolean,
arguments: FieldTable
) -> Result<RequestId, Error>
pub fn receive_queue_declare_ok(
&mut self,
_channel_id: u16,
method: DeclareOk
) -> Result<(), Error>
[src]
&mut self,
_channel_id: u16,
method: DeclareOk
) -> Result<(), Error>
pub fn queue_bind(
&mut self,
_channel_id: u16,
ticket: ShortUInt,
queue: ShortString,
exchange: ShortString,
routing_key: ShortString,
nowait: Boolean,
arguments: FieldTable
) -> Result<RequestId, Error>
[src]
&mut self,
_channel_id: u16,
ticket: ShortUInt,
queue: ShortString,
exchange: ShortString,
routing_key: ShortString,
nowait: Boolean,
arguments: FieldTable
) -> Result<RequestId, Error>
pub fn receive_queue_bind_ok(
&mut self,
_channel_id: u16,
_: BindOk
) -> Result<(), Error>
[src]
&mut self,
_channel_id: u16,
_: BindOk
) -> Result<(), Error>
pub fn queue_purge(
&mut self,
_channel_id: u16,
ticket: ShortUInt,
queue: ShortString,
nowait: Boolean
) -> Result<RequestId, Error>
[src]
&mut self,
_channel_id: u16,
ticket: ShortUInt,
queue: ShortString,
nowait: Boolean
) -> Result<RequestId, Error>
pub fn receive_queue_purge_ok(
&mut self,
_channel_id: u16,
_: PurgeOk
) -> Result<(), Error>
[src]
&mut self,
_channel_id: u16,
_: PurgeOk
) -> Result<(), Error>
pub fn queue_delete(
&mut self,
_channel_id: u16,
ticket: ShortUInt,
queue: ShortString,
if_unused: Boolean,
if_empty: Boolean,
nowait: Boolean
) -> Result<RequestId, Error>
[src]
&mut self,
_channel_id: u16,
ticket: ShortUInt,
queue: ShortString,
if_unused: Boolean,
if_empty: Boolean,
nowait: Boolean
) -> Result<RequestId, Error>
pub fn receive_queue_delete_ok(
&mut self,
_channel_id: u16,
_: DeleteOk
) -> Result<(), Error>
[src]
&mut self,
_channel_id: u16,
_: DeleteOk
) -> Result<(), Error>
pub fn queue_unbind(
&mut self,
_channel_id: u16,
ticket: ShortUInt,
queue: ShortString,
exchange: ShortString,
routing_key: ShortString,
arguments: FieldTable
) -> Result<RequestId, Error>
[src]
&mut self,
_channel_id: u16,
ticket: ShortUInt,
queue: ShortString,
exchange: ShortString,
routing_key: ShortString,
arguments: FieldTable
) -> Result<RequestId, Error>
pub fn receive_queue_unbind_ok(
&mut self,
_channel_id: u16,
_: UnbindOk
) -> Result<(), Error>
[src]
&mut self,
_channel_id: u16,
_: UnbindOk
) -> Result<(), Error>
pub fn basic_qos(
&mut self,
_channel_id: u16,
prefetch_size: LongUInt,
prefetch_count: ShortUInt,
global: Boolean
) -> Result<RequestId, Error>
[src]
&mut self,
_channel_id: u16,
prefetch_size: LongUInt,
prefetch_count: ShortUInt,
global: Boolean
) -> Result<RequestId, Error>
pub fn receive_basic_qos_ok(
&mut self,
_channel_id: u16,
_: QosOk
) -> Result<(), Error>
[src]
&mut self,
_channel_id: u16,
_: QosOk
) -> Result<(), Error>
pub fn basic_consume(
&mut self,
_channel_id: u16,
ticket: ShortUInt,
queue: ShortString,
consumer_tag: ShortString,
no_local: Boolean,
no_ack: Boolean,
exclusive: Boolean,
nowait: Boolean,
arguments: FieldTable,
subscriber: Box<dyn ConsumerSubscriber>
) -> Result<RequestId, Error>
[src]
&mut self,
_channel_id: u16,
ticket: ShortUInt,
queue: ShortString,
consumer_tag: ShortString,
no_local: Boolean,
no_ack: Boolean,
exclusive: Boolean,
nowait: Boolean,
arguments: FieldTable,
subscriber: Box<dyn ConsumerSubscriber>
) -> Result<RequestId, Error>
pub fn receive_basic_consume_ok(
&mut self,
_channel_id: u16,
method: ConsumeOk
) -> Result<(), Error>
[src]
&mut self,
_channel_id: u16,
method: ConsumeOk
) -> Result<(), Error>
pub fn basic_cancel(
&mut self,
_channel_id: u16,
consumer_tag: ShortString,
nowait: Boolean
) -> Result<RequestId, Error>
[src]
&mut self,
_channel_id: u16,
consumer_tag: ShortString,
nowait: Boolean
) -> Result<RequestId, Error>
pub fn receive_basic_cancel_ok(
&mut self,
_channel_id: u16,
method: CancelOk
) -> Result<(), Error>
[src]
&mut self,
_channel_id: u16,
method: CancelOk
) -> Result<(), Error>
pub fn basic_publish(
&mut self,
_channel_id: u16,
ticket: ShortUInt,
exchange: ShortString,
routing_key: ShortString,
mandatory: Boolean,
immediate: Boolean
) -> Result<u64, Error>
[src]
&mut self,
_channel_id: u16,
ticket: ShortUInt,
exchange: ShortString,
routing_key: ShortString,
mandatory: Boolean,
immediate: Boolean
) -> Result<u64, Error>
pub fn receive_basic_deliver(
&mut self,
_channel_id: u16,
method: Deliver
) -> Result<(), Error>
[src]
&mut self,
_channel_id: u16,
method: Deliver
) -> Result<(), Error>
pub fn basic_get(
&mut self,
_channel_id: u16,
ticket: ShortUInt,
queue: ShortString,
no_ack: Boolean
) -> Result<RequestId, Error>
[src]
&mut self,
_channel_id: u16,
ticket: ShortUInt,
queue: ShortString,
no_ack: Boolean
) -> Result<RequestId, Error>
pub fn receive_basic_get_ok(
&mut self,
_channel_id: u16,
method: GetOk
) -> Result<(), Error>
[src]
&mut self,
_channel_id: u16,
method: GetOk
) -> Result<(), Error>
pub fn receive_basic_get_empty(
&mut self,
_channel_id: u16,
_: GetEmpty
) -> Result<(), Error>
[src]
&mut self,
_channel_id: u16,
_: GetEmpty
) -> Result<(), Error>
pub fn basic_ack(
&mut self,
_channel_id: u16,
delivery_tag: LongLongUInt,
multiple: Boolean
) -> Result<(), Error>
[src]
&mut self,
_channel_id: u16,
delivery_tag: LongLongUInt,
multiple: Boolean
) -> Result<(), Error>
pub fn basic_reject(
&mut self,
_channel_id: u16,
delivery_tag: LongLongUInt,
requeue: Boolean
) -> Result<(), Error>
[src]
&mut self,
_channel_id: u16,
delivery_tag: LongLongUInt,
requeue: Boolean
) -> Result<(), Error>
pub fn basic_recover_async(
&mut self,
_channel_id: u16,
requeue: Boolean
) -> Result<(), Error>
[src]
&mut self,
_channel_id: u16,
requeue: Boolean
) -> Result<(), Error>
pub fn basic_recover(
&mut self,
_channel_id: u16,
requeue: Boolean
) -> Result<RequestId, Error>
[src]
&mut self,
_channel_id: u16,
requeue: Boolean
) -> Result<RequestId, Error>
pub fn receive_basic_recover_ok(
&mut self,
_channel_id: u16,
_: RecoverOk
) -> Result<(), Error>
[src]
&mut self,
_channel_id: u16,
_: RecoverOk
) -> Result<(), Error>
pub fn basic_nack(
&mut self,
_channel_id: u16,
delivery_tag: LongLongUInt,
multiple: Boolean,
requeue: Boolean
) -> Result<(), Error>
[src]
&mut self,
_channel_id: u16,
delivery_tag: LongLongUInt,
multiple: Boolean,
requeue: Boolean
) -> Result<(), Error>
pub fn confirm_select(
&mut self,
_channel_id: u16,
nowait: Boolean
) -> Result<RequestId, Error>
[src]
&mut self,
_channel_id: u16,
nowait: Boolean
) -> Result<RequestId, Error>
pub fn receive_confirm_select_ok(
&mut self,
_channel_id: u16,
_: SelectOk
) -> Result<(), Error>
[src]
&mut self,
_channel_id: u16,
_: SelectOk
) -> Result<(), Error>
pub fn receive_basic_ack(
&mut self,
_channel_id: u16,
method: Ack
) -> Result<(), Error>
[src]
&mut self,
_channel_id: u16,
method: Ack
) -> Result<(), Error>
pub fn receive_basic_nack(
&mut self,
_channel_id: u16,
method: Nack
) -> Result<(), Error>
[src]
&mut self,
_channel_id: u16,
method: Nack
) -> Result<(), Error>
impl Connection
[src]
pub fn new() -> Connection
[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 set_heartbeat(&mut self, heartbeat: u16)
[src]
pub fn set_channel_max(&mut self, channel_max: u16)
[src]
pub fn set_frame_max(&mut self, frame_max: u32)
[src]
pub fn create_channel(&mut self) -> Option<u16>
[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
pub fn set_channel_state(&mut self, channel_id: u16, new_state: ChannelState)
[src]
pub fn check_state(
&self,
channel_id: u16,
state: ChannelState
) -> Result<(), Error>
[src]
&self,
channel_id: u16,
state: ChannelState
) -> Result<(), Error>
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
pub fn get_state(&self, channel_id: u16) -> Option<ChannelState>
[src]
returns the channel's state
returns a Option of the state. Non in the case the channel does not exists
pub fn is_connected(&self, channel_id: u16) -> bool
[src]
verifies if the channel is connecyed
pub fn get_generated_name(&mut self, id: RequestId) -> Option<String>
[src]
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
pub fn is_finished(&mut self, id: RequestId) -> Option<bool>
[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
pub fn finished_get_result(&mut self, id: RequestId) -> Option<bool>
[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
pub fn next_basic_get_message(
&mut self,
channel_id: u16,
queue_name: &str
) -> Option<BasicGetMessage>
[src]
&mut self,
channel_id: u16,
queue_name: &str
) -> Option<BasicGetMessage>
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
pub fn connect(&mut self) -> 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]
&mut self,
send_buffer: &mut [u8]
) -> Result<(usize, ConnectionState)>
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
pub fn send_content_frames(
&mut self,
channel_id: u16,
class_id: u16,
slice: &[u8],
properties: BasicProperties
)
[src]
&mut self,
channel_id: u16,
class_id: u16,
slice: &[u8],
properties: BasicProperties
)
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]
pub fn run<T>(
&mut self,
stream: &mut T,
send_buffer: &mut Buffer,
receive_buffer: &mut Buffer
) -> Result<ConnectionState> where
T: Read + Write,
[src]
&mut self,
stream: &mut T,
send_buffer: &mut Buffer,
receive_buffer: &mut Buffer
) -> Result<ConnectionState> where
T: Read + Write,
helper function to handle reading and writing repeatedly from the network until there's no more state to update
pub fn can_write(&self, send_buffer: &Buffer) -> bool
[src]
tests whether we can write to the send buffer
pub fn can_read(&self, receive_buffer: &Buffer) -> bool
[src]
tests whether we can read from the receive buffer
pub fn can_parse(&self, receive_buffer: &Buffer) -> bool
[src]
tests whether we can parse data from the receive buffer
pub fn write_to_stream(
&mut self,
writer: &mut dyn Write,
send_buffer: &mut Buffer
) -> Result<(usize, ConnectionState)>
[src]
&mut self,
writer: &mut dyn Write,
send_buffer: &mut Buffer
) -> Result<(usize, ConnectionState)>
serializes frames to the send buffer then to the writer (if possible)
pub fn read_from_stream(
&mut self,
reader: &mut dyn Read,
receive_buffer: &mut Buffer
) -> Result<(usize, ConnectionState)>
[src]
&mut self,
reader: &mut dyn Read,
receive_buffer: &mut Buffer
) -> Result<(usize, ConnectionState)>
read data from the network into the receive buffer
Trait Implementations
Auto Trait Implementations
impl Send for Connection
impl Sync for Connection
Blanket Implementations
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From for T
[src]
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = !
try_from
)The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
try_from
)The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,