pub struct CtxMapView<'a, S: Schema>(/* private fields */);Expand description
Mutable reference to CtxMap where the value has changed.
Use CtxMapViwe instead of &mut CtxMap because &mut CtxMap,
whose value has been changed, will be broken if std::mem::swap is used.
Implementations§
Source§impl<'a, S: Schema> CtxMapView<'a, S>
impl<'a, S: Schema> CtxMapView<'a, S>
Sourcepub fn with<T: ?Sized + 'static, U>(
&mut self,
key: &'static Key<S, T>,
value: &T,
f: impl FnOnce(&mut CtxMapView<'_, S>) -> U,
) -> U
pub fn with<T: ?Sized + 'static, U>( &mut self, key: &'static Key<S, T>, value: &T, f: impl FnOnce(&mut CtxMapView<'_, S>) -> U, ) -> U
Sets a value to CtxMap only while f is being called.
See CtxMap::with for more details.
Sourcepub fn with_mut<T: ?Sized + 'static, U, const MUT: bool>(
&mut self,
key: &'static Key<S, T, MUT>,
value: &mut T,
f: impl FnOnce(&mut CtxMapView<'_, S>) -> U,
) -> U
pub fn with_mut<T: ?Sized + 'static, U, const MUT: bool>( &mut self, key: &'static Key<S, T, MUT>, value: &mut T, f: impl FnOnce(&mut CtxMapView<'_, S>) -> U, ) -> U
Sets a mutable value to CtxMap only while f is being called.
See CtxMap::with_mut for more details.
Sourcepub fn view(&mut self) -> CtxMapView<'_, S>
pub fn view(&mut self) -> CtxMapView<'_, S>
Return CtxMapView with modified lifetime.
Trait Implementations§
Auto Trait Implementations§
impl<'a, S> Freeze for CtxMapView<'a, S>
impl<'a, S> !RefUnwindSafe for CtxMapView<'a, S>
impl<'a, S> !Send for CtxMapView<'a, S>
impl<'a, S> !Sync for CtxMapView<'a, S>
impl<'a, S> Unpin for CtxMapView<'a, S>
impl<'a, S> !UnwindSafe for CtxMapView<'a, S>
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