pub struct ClientHandle { /* private fields */ }Expand description
Handle for sending messages and receiving events.
Implementations§
Source§impl ClientHandle
impl ClientHandle
Sourcepub fn send(&mut self, message: Vec<u8>) -> Result<(), ClientError>
pub fn send(&mut self, message: Vec<u8>) -> Result<(), ClientError>
Sends an SBE message to the server (non-blocking).
§Errors
Returns error if the channel is disconnected.
Sourcepub fn disconnect(&mut self)
pub fn disconnect(&mut self)
Disconnects from the server.
Sourcepub fn poll(&mut self) -> Option<ClientEvent>
pub fn poll(&mut self) -> Option<ClientEvent>
Polls for events (non-blocking).
Sourcepub fn poll_spin(&mut self) -> ClientEvent
pub fn poll_spin(&mut self) -> ClientEvent
Busy-poll for next event (for hot path).
Sourcepub fn drain(&mut self) -> impl Iterator<Item = ClientEvent> + '_
pub fn drain(&mut self) -> impl Iterator<Item = ClientEvent> + '_
Drains all available events.
Sourcepub async fn wait_event(&mut self) -> Option<ClientEvent>
pub async fn wait_event(&mut self) -> Option<ClientEvent>
Asynchronously waits for the next event.
Returns Some(event) when an event is available, or keeps waiting.
Returns None only if the sender (client) has been dropped.
Sourcepub fn event_notifier(&self) -> Arc<Notify>
pub fn event_notifier(&self) -> Arc<Notify>
Returns a clone of the event notification handle.
Use this to await event availability when holding the handle behind
a Mutex — await the notifier outside the lock, then lock and
drain with [poll].
Auto Trait Implementations§
impl !Freeze for ClientHandle
impl !RefUnwindSafe for ClientHandle
impl Send for ClientHandle
impl !Sync for ClientHandle
impl Unpin for ClientHandle
impl UnsafeUnpin for ClientHandle
impl UnwindSafe for ClientHandle
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