pub struct RequestRegistry { /* private fields */ }Expand description
Every request that has not finished.
Implementations§
Source§impl RequestRegistry
impl RequestRegistry
Sourcepub fn register(
&mut self,
id: RequestId,
entry: InFlight,
) -> Result<(), DuplicateRequest>
pub fn register( &mut self, id: RequestId, entry: InFlight, ) -> Result<(), DuplicateRequest>
Records a request as in flight.
§Errors
DuplicateRequest if the id is already in flight. The existing entry
is left alone: the first request owns the id, and displacing it would
make a later cancellation abort the wrong work.
Sourcepub fn get(&self, id: &RequestId) -> Option<&InFlight>
pub fn get(&self, id: &RequestId) -> Option<&InFlight>
The entry for id, if it is still in flight.
Sourcepub fn get_mut(&mut self, id: &RequestId) -> Option<&mut InFlight>
pub fn get_mut(&mut self, id: &RequestId) -> Option<&mut InFlight>
The entry for id, mutably, if it is still in flight.
Sourcepub fn cancel(
&mut self,
id: &RequestId,
reason: Option<CancelReason>,
) -> CancelOutcome
pub fn cancel( &mut self, id: &RequestId, reason: Option<CancelReason>, ) -> CancelOutcome
Cancels a request.
Never fails. See CancelOutcome.
Sourcepub fn expire(&mut self, now: Instant) -> Vec<RequestId>
pub fn expire(&mut self, now: Instant) -> Vec<RequestId>
Aborts and removes every request whose budget is spent at now.
The returned ids are the ones the caller should report, in no particular order: this runs on a tick rather than per frame, and sorting to make the output deterministic would be work whose result nothing reads.
Sourcepub fn complete(&mut self, id: &RequestId) -> Option<InFlight>
pub fn complete(&mut self, id: &RequestId) -> Option<InFlight>
Removes a finished request and returns what it was.
Trait Implementations§
Source§impl Debug for RequestRegistry
impl Debug for RequestRegistry
Auto Trait Implementations§
impl Freeze for RequestRegistry
impl RefUnwindSafe for RequestRegistry
impl Send for RequestRegistry
impl Sync for RequestRegistry
impl Unpin for RequestRegistry
impl UnsafeUnpin for RequestRegistry
impl UnwindSafe for RequestRegistry
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