Struct distant_core::Session [−][src]
pub struct Session<T> where
T: DataStream, {
pub broadcast: Option<Receiver<Response>>,
// some fields omitted
}
Expand description
Represents a session with a remote server that can be used to send requests & receive responses
Fields
broadcast: Option<Receiver<Response>>
Represents the receiver for broadcasted responses (ones with no callback)
Implementations
Connect to a remote TCP server using the provided information
Connect to a remote TCP server, timing out after duration has passed
Initializes a session using the provided transport
Waits for the session to terminate, which results when the receiving end of the network connection is closed (or the session is shutdown)
Abort the session’s current connection by forcing its response task to shutdown
Sends a request and waits for a response
pub async fn send_timeout(
&mut self,
req: Request,
duration: Duration
) -> Result<Response, TransportError>
pub async fn send_timeout(
&mut self,
req: Request,
duration: Duration
) -> Result<Response, TransportError>
Sends a request and waits for a response, timing out after duration has passed
Sends a request without waiting for a response
Any response that would be received gets sent over the broadcast channel instead
pub async fn fire_timeout(
&mut self,
req: Request,
duration: Duration
) -> Result<(), TransportError>
pub async fn fire_timeout(
&mut self,
req: Request,
duration: Duration
) -> Result<(), TransportError>
Sends a request without waiting for a response, timing out after duration has passed