[−][src]Struct lapin_async::connection::Connection
Fields
state: ConnectionState
current state of the connection. In normal use it should always be ConnectionState::Connected
channels: Channels
configuration: Configuration
vhost: String
Methods
impl Connection
[src]
pub fn new() -> Self
[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 connect(
&mut self,
options: ConnectionProperties
) -> Result<ConnectionState>
[src]
&mut self,
options: ConnectionProperties
) -> Result<ConnectionState>
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
impl Connection
[src]
pub fn run<T: Read + Write>(
&mut self,
stream: &mut T,
send_buffer: &mut Buffer,
receive_buffer: &mut Buffer
) -> Result<ConnectionState>
[src]
&mut self,
stream: &mut T,
send_buffer: &mut Buffer,
receive_buffer: &mut Buffer
) -> Result<ConnectionState>
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 Debug for Connection
[src]
Auto Trait Implementations
impl Send for Connection
impl Sync for Connection
Blanket Implementations
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
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, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,