Struct tomsg_rs::connection::Connection [−][src]
pub struct Connection { /* fields omitted */ }
Expand description
A connection with a tomsg server.
Implementations
impl Connection
[src]
impl Connection
[src]pub async fn connect(
_typ: Type,
address: impl ToSocketAddrs
) -> Result<(Self, Receiver<PushMessage>)>
[src]
pub async fn connect(
_typ: Type,
address: impl ToSocketAddrs
) -> Result<(Self, Receiver<PushMessage>)>
[src]Creates a new Connection
with the given _typ
and connects to the given address
.
Returns a Result
containing either an io::Error
as an Error
value, or a pair of a
Connection
and the receiver end of a mpsc
channel where PushMessage
instances are
sent to.
pub fn send_command<'a, 'b>(
&'a self,
command: Command<'b>
) -> impl Future<Output = Result<Result<Reply, CloseReason>>> + 'a
[src]
pub fn send_command<'a, 'b>(
&'a self,
command: Command<'b>
) -> impl Future<Output = Result<Result<Reply, CloseReason>>> + 'a
[src]Send the given command
to this Connection
.
pub async fn close_reason(&self) -> Option<CloseReason>
[src]
pub async fn close_reason(&self) -> Option<CloseReason>
[src]Gets the reason this Connection
is closed, or None
if the Connection
is still open.