Struct simple_websockets::EventHub
source · pub struct EventHub { /* private fields */ }
Expand description
A queue of incoming events from clients.
The EventHub
is the centerpiece of this library, and it is where all
messages, connections, and disconnections are received.
Implementations§
source§impl EventHub
impl EventHub
sourcepub fn drain(&self) -> Vec<Event>
pub fn drain(&self) -> Vec<Event>
Clears the event queue and returns all the events that were in the queue.
sourcepub fn next_event(&self) -> Option<Event>
pub fn next_event(&self) -> Option<Event>
Returns the next event, or None if the queue is empty.
sourcepub fn poll_event(&self) -> Event
pub fn poll_event(&self) -> Event
Returns the next event, blocking if the queue is empty.
sourcepub async fn poll_async(&self) -> Event
pub async fn poll_async(&self) -> Event
Async version of poll_event
Trait Implementations§
Auto Trait Implementations§
impl RefUnwindSafe for EventHub
impl Send for EventHub
impl Sync for EventHub
impl Unpin for EventHub
impl UnwindSafe for EventHub
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