pub struct SseConnection { /* private fields */ }Expand description
A reserved SSE stream slot, released when dropped.
Keep it alive for as long as the stream it guards: move it into the stream so the slot is freed when the client disconnects or the stream ends.
§Examples
use ironflow_api::sse_limiter::SseLimiter;
use uuid::Uuid;
let limiter = SseLimiter::default();
let connection = limiter.try_acquire(Uuid::now_v7())?;
assert_eq!(limiter.open_connections(), 1);
drop(connection);
assert_eq!(limiter.open_connections(), 0);Trait Implementations§
Source§impl Debug for SseConnection
impl Debug for SseConnection
Source§impl Drop for SseConnection
impl Drop for SseConnection
Auto Trait Implementations§
impl Freeze for SseConnection
impl RefUnwindSafe for SseConnection
impl Send for SseConnection
impl Sync for SseConnection
impl Unpin for SseConnection
impl UnsafeUnpin for SseConnection
impl UnwindSafe for SseConnection
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