pub struct Event { /* private fields */ }Expand description
An event from the server: its name, its arguments and, when the server asked for one, the means to acknowledge it.
Implementations§
Source§impl Event
impl Event
Sourcepub fn into_payload(self) -> Payload
pub fn into_payload(self) -> Payload
The arguments, owned.
Sourcepub fn arg<T: DeserializeOwned>(&self, index: usize) -> Result<T>
pub fn arg<T: DeserializeOwned>(&self, index: usize) -> Result<T>
Argument index as T (see Payload::arg).
Sourcepub fn wants_ack(&self) -> bool
pub fn wants_ack(&self) -> bool
The server emitted this event with a callback (socket.emit("ev", data, (reply) => ..)).
Sourcepub fn ack(&self, data: impl Into<Payload>) -> Result<()>
pub fn ack(&self, data: impl Into<Payload>) -> Result<()>
Answers the server’s callback with data. Sent at most once: later calls (and calls on
clones) are ignored, as in socket.io-client. A no-op when no ack was requested.
Sourcepub fn ack_sender(&self) -> Option<AckSender>
pub fn ack_sender(&self) -> Option<AckSender>
The ack handle, to answer later or from another task.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for Event
impl Forget for Event
impl RefUnwindSafe for Event
impl Send for Event
impl Sync for Event
impl Unpin for Event
impl UnsafeUnpin for Event
impl UnwindSafe for Event
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