pub struct ClientDispatcher<T: Transport> { /* private fields */ }
Expand description
A dispatcher for a client endpoint.
A client dispatcher receives all of the incoming messages and dispatches them to the client handler and two-way futures. It acts as the message pump for the client.
The dispatcher must be actively polled to receive events and two-way message responses. If the
dispatcher is not run
concurrently, then events will not be received
and two-way message futures will not receive their responses.
Implementations§
Source§impl<T: Transport> ClientDispatcher<T>
impl<T: Transport> ClientDispatcher<T>
Sourcepub fn client(&self) -> Client<T>
pub fn client(&self) -> Client<T>
Returns a client for the dispatcher.
When the last Client
is dropped, the dispatcher will be stopped.
Sourcepub async fn run<H>(self, handler: H) -> Result<H, ProtocolError<T::Error>>where
H: ClientHandler<T>,
pub async fn run<H>(self, handler: H) -> Result<H, ProtocolError<T::Error>>where
H: ClientHandler<T>,
Runs the client with the provided handler.
Sourcepub async fn run_client(self) -> Result<(), ProtocolError<T::Error>>
pub async fn run_client(self) -> Result<(), ProtocolError<T::Error>>
Runs the client with the IgnoreEvents
handler.
Trait Implementations§
Auto Trait Implementations§
impl<T> Freeze for ClientDispatcher<T>
impl<T> !RefUnwindSafe for ClientDispatcher<T>
impl<T> Send for ClientDispatcher<T>
impl<T> Sync for ClientDispatcher<T>
impl<T> Unpin for ClientDispatcher<T>
impl<T> !UnwindSafe for ClientDispatcher<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