pub struct TcpConnection { /* private fields */ }Expand description
TCP connection to a snapserver.
Implementations§
Source§impl TcpConnection
impl TcpConnection
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 without waiting for a response.
Sourcepub async fn send_request(
&mut self,
msg_type: MessageType,
payload: &MessagePayload,
timeout: Duration,
) -> Result<TypedMessage>
pub async fn send_request( &mut self, msg_type: MessageType, payload: &MessagePayload, timeout: Duration, ) -> Result<TypedMessage>
Send a request and wait for the response (matched by refersTo).
Sourcepub async fn recv(&mut self) -> Result<TypedMessage>
pub async fn recv(&mut self) -> Result<TypedMessage>
Receive the next message. If it’s a response to a pending request, deliver it to the waiting caller and receive again.
Auto Trait Implementations§
impl !Freeze for TcpConnection
impl !RefUnwindSafe for TcpConnection
impl Send for TcpConnection
impl Sync for TcpConnection
impl Unpin for TcpConnection
impl UnsafeUnpin for TcpConnection
impl !UnwindSafe for TcpConnection
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