pub struct SseEvent { /* private fields */ }Expand description
One validated Server-Sent Event.
Implementations§
Source§impl SseEvent
impl SseEvent
pub fn new() -> Self
Sourcepub fn id(self, id: impl Into<String>) -> Result<Self, InvalidSseField>
pub fn id(self, id: impl Into<String>) -> Result<Self, InvalidSseField>
Set the reconnection cursor sent back as Last-Event-ID.
§Errors
Rejects oversized, NUL, CR, or LF values.
pub fn data(self, data: impl Into<String>) -> Self
Sourcepub fn json_data<T>(self, data: &T) -> Result<Self, Error>where
T: Serialize,
pub fn json_data<T>(self, data: &T) -> Result<Self, Error>where
T: Serialize,
Serialize structured data into one SSE data field.
§Errors
Returns the serializer error for unsupported values.
pub const fn retry(self, retry: Duration) -> Self
Trait Implementations§
impl Eq for SseEvent
impl StructuralPartialEq for SseEvent
Auto Trait Implementations§
impl Freeze for SseEvent
impl RefUnwindSafe for SseEvent
impl Send for SseEvent
impl Sync for SseEvent
impl Unpin for SseEvent
impl UnsafeUnpin for SseEvent
impl UnwindSafe for SseEvent
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.