pub struct UrlHub { /* private fields */ }Expand description
Queue, de-dup and dispatch logic with an injectable clock. hub owns the process-wide one.
Implementations§
Source§impl UrlHub
impl UrlHub
pub fn new() -> Self
Sourcepub fn deliver_at<I, S>(&self, urls: I, now: Instant) -> usize
pub fn deliver_at<I, S>(&self, urls: I, now: Instant) -> usize
Deliver URLs. Invalid and duplicate entries are dropped; the rest are buffered (no handler yet) or passed to every handler in registration order, outside the hub lock. Returns how many URLs were new.
pub fn deliver<I, S>(&self, urls: I) -> usize
Sourcepub fn on_open_url(&self, handler: UrlHandler)
pub fn on_open_url(&self, handler: UrlHandler)
Register a handler for URLs that arrive from now on. Cold-start URLs stay readable through
UrlHub::current_urls; they are not replayed.
Sourcepub fn current_urls(&self) -> Vec<String>
pub fn current_urls(&self) -> Vec<String>
URLs that arrived before the first handler was registered, in arrival order.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for UrlHub
impl RefUnwindSafe for UrlHub
impl Send for UrlHub
impl Sync for UrlHub
impl Unpin for UrlHub
impl UnsafeUnpin for UrlHub
impl UnwindSafe for UrlHub
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