pub struct SseSender { /* private fields */ }Expand description
Sends events to one streaming SSE response; clone it to send from several places. The stream ends when the last clone is dropped.
Implementations§
Source§impl SseSender
impl SseSender
Sourcepub fn send(&self, event: SseEvent) -> Result<(), SseClosed>
pub fn send(&self, event: SseEvent) -> Result<(), SseClosed>
Send event, waiting while the buffer is full (a slow client slows
the sender down rather than growing memory). Blocks the thread: in
async code use Self::send_async or Self::try_send.
Sourcepub fn try_send(&self, event: SseEvent) -> Result<bool, SseClosed>
pub fn try_send(&self, event: SseEvent) -> Result<bool, SseClosed>
Send event if there’s room: Ok(false) when the buffer is full and
the event was dropped.
Sourcepub async fn send_async(&self, event: SseEvent) -> Result<(), SseClosed>
pub async fn send_async(&self, event: SseEvent) -> Result<(), SseClosed>
Self::send without blocking the async runtime: waits for room
with short sleeps.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for SseSender
impl RefUnwindSafe for SseSender
impl Send for SseSender
impl Sync for SseSender
impl Unpin for SseSender
impl UnsafeUnpin for SseSender
impl UnwindSafe for SseSender
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