pub struct AccessContext<O, K> { /* private fields */ }Expand description
Budget and reentry state shared by one property operation.
Implementations§
Source§impl<O, K> AccessContext<O, K>
impl<O, K> AccessContext<O, K>
Sourcepub fn new(work_budget: usize) -> Self
pub fn new(work_budget: usize) -> Self
Creates an operation context with an exact work allowance.
Sourcepub fn intercept<T, E>(
&mut self,
kind: AccessKind,
receiver: &O,
key: &K,
call: impl FnOnce(&mut Self) -> Result<T, AccessError<E>>,
) -> Result<T, AccessError<E>>
pub fn intercept<T, E>( &mut self, kind: AccessKind, receiver: &O, key: &K, call: impl FnOnce(&mut Self) -> Result<T, AccessError<E>>, ) -> Result<T, AccessError<E>>
Runs one guarded interception. Nested hooks may use this method to preserve the same budget and reentry invariant.
Auto Trait Implementations§
impl<O, K> Freeze for AccessContext<O, K>
impl<O, K> RefUnwindSafe for AccessContext<O, K>where
O: RefUnwindSafe,
K: RefUnwindSafe,
impl<O, K> Send for AccessContext<O, K>
impl<O, K> Sync for AccessContext<O, K>
impl<O, K> Unpin for AccessContext<O, K>
impl<O, K> UnsafeUnpin for AccessContext<O, K>
impl<O, K> UnwindSafe for AccessContext<O, K>where
O: UnwindSafe,
K: UnwindSafe,
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