pub enum SnapConnection {
Tcp(TcpConnection),
}Expand description
Unified connection over supported transports.
Variants§
Tcp(TcpConnection)
Plain TCP connection.
Implementations§
Source§impl SnapConnection
impl SnapConnection
Sourcepub fn new(scheme: &str, host: &str, port: u16) -> Result<Self>
pub fn new(scheme: &str, host: &str, port: u16) -> Result<Self>
Create a new connection based on the scheme.
Sourcepub fn disconnect(&mut self)
pub fn disconnect(&mut self)
Close the connection.
Sourcepub async fn send(
&mut self,
msg_type: MessageType,
payload: &MessagePayload,
) -> Result<()>
pub async fn send( &mut self, msg_type: MessageType, payload: &MessagePayload, ) -> Result<()>
Send a message.
Sourcepub async fn recv(&mut self) -> Result<TypedMessage>
pub async fn recv(&mut self) -> Result<TypedMessage>
Receive the next message.
Auto Trait Implementations§
impl !Freeze for SnapConnection
impl !RefUnwindSafe for SnapConnection
impl Send for SnapConnection
impl Sync for SnapConnection
impl Unpin for SnapConnection
impl UnsafeUnpin for SnapConnection
impl !UnwindSafe for SnapConnection
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more