Struct aldrin_broker::Connection
source · pub struct Connection<T>where
T: AsyncTransport + Unpin,{ /* private fields */ }
Expand description
Connection between a broker and a client.
Connection
s can be established with BrokerHandle::connect
and must then be run
and polled to completion.
You can optionally acquire a ConnectionHandle
if you need to be able
to shut down specific Connection
s.
Implementations§
source§impl<T> Connection<T>where
T: AsyncTransport + Unpin,
impl<T> Connection<T>where
T: AsyncTransport + Unpin,
sourcepub fn handle(&self) -> &ConnectionHandle
pub fn handle(&self) -> &ConnectionHandle
Returns a reference to the connection handle.
ConnectionHandle
s can be used to shut
down a specific Connection
.
Note also, that this method returns only a reference. However, ConnectionHandle
s are cheap
to clone
.
sourcepub async fn run(self) -> Result<(), ConnectionError<T::Error>>
pub async fn run(self) -> Result<(), ConnectionError<T::Error>>
Runs the connections.
After establishing a new Connection
, this method must be
called and polled to completion to run the Connection
.
Trait Implementations§
Auto Trait Implementations§
impl<T> !RefUnwindSafe for Connection<T>
impl<T> Send for Connection<T>where
T: Send,
impl<T> Sync for Connection<T>where
T: Sync,
impl<T> Unpin for Connection<T>
impl<T> !UnwindSafe for Connection<T>
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