pub struct Budget<'d> { /* private fields */ }Expand description
One absolute multi-operation budget tied to an exact driver generation.
Implementations§
Source§impl<'d> Budget<'d>
impl<'d> Budget<'d>
Sourcepub fn try_new(
timer: Timer<'d>,
started: Moment<'d>,
duration: Duration,
) -> Result<Self, Error>
pub fn try_new( timer: Timer<'d>, started: Moment<'d>, duration: Duration, ) -> Result<Self, Error>
Constructs one absolute budget and reserves its timer slot once.
Sourcepub fn scope(&mut self, sample: Moment<'d>, duration: Duration) -> Scope<'_, 'd>
pub fn scope(&mut self, sample: Moment<'d>, duration: Duration) -> Scope<'_, 'd>
Samples a finite operation limit once without changing the driver clock.
Duration::MAX keeps the enclosing bound without sampling.
Sourcepub fn limit(&mut self, now: Moment<'d>, duration: Duration) -> Scope<'_, 'd>
pub fn limit(&mut self, now: Moment<'d>, duration: Duration) -> Scope<'_, 'd>
Narrows this budget without reserving another timer slot.
Sourcepub fn timeout<'scope, F>(&'scope mut self, fiber: F) -> Timeout<'scope, 'd, F>where
F: Fiber<'d> + 'scope,
pub fn timeout<'scope, F>(&'scope mut self, fiber: F) -> Timeout<'scope, 'd, F>where
F: Fiber<'d> + 'scope,
Runs one fiber under this budget’s absolute deadline.
Sourcepub fn timeout_for<'scope, F>(
&'scope mut self,
duration: Duration,
fiber: F,
) -> Timeout<'scope, 'd, F>where
F: Fiber<'d> + 'scope,
pub fn timeout_for<'scope, F>(
&'scope mut self,
duration: Duration,
fiber: F,
) -> Timeout<'scope, 'd, F>where
F: Fiber<'d> + 'scope,
Runs one fiber under the earlier of this budget and a relative limit.
Auto Trait Implementations§
impl<'d> !RefUnwindSafe for Budget<'d>
impl<'d> !Send for Budget<'d>
impl<'d> !Sync for Budget<'d>
impl<'d> !UnwindSafe for Budget<'d>
impl<'d> Forget for Budget<'d>
impl<'d> Freeze for Budget<'d>where
PhantomData<(fn(&'d ()) -> &'d (), ThreadBound)>: Freeze,
Root<'d, Shared<Context<Receive>>>: Freeze,
Lease<'d, Tag>: Freeze,
PhantomData<Open>: Freeze,
impl<'d> Move for Budget<'d>
impl<'d> Unpin for Budget<'d>
impl<'d> UnsafeUnpin for Budget<'d>where
PhantomData<(fn(&'d ()) -> &'d (), ThreadBound)>: UnsafeUnpin,
Root<'d, Shared<Context<Receive>>>: UnsafeUnpin,
Lease<'d, Tag>: UnsafeUnpin,
PhantomData<Open>: UnsafeUnpin,
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