[−][src]Struct snec::ModificationScope
A drop guard for modifying data bahind a Handle
using a mutable reference instead of moving in a new value.
Since Storage
should notify a receiver whenever data inside of it is modified, it cannot simply hand out mutable references to the value, because that'd allow outside code to implicitly perform a silent storage modification. While ways to do so are also provided, it's heavily discouraged and reserved for special cases.
The solution to the problem is this struct: ModificationScope
. It's a drop guard which is created by providing a receiver to the storage. While it has little to no differences to a mutable reference to the data inside in terms of functionality, it notifies the receiver when dropped, ensuring that it will get modified even if a panic or any other kind of early return happens.
Trait Implementations
impl<'a, 'b, E, R> AsMut<Handle<'a, E, R>> for ModificationScope<'a, 'b, E, R> where
E: Entry,
R: Receiver<E>,
[src]
E: Entry,
R: Receiver<E>,
impl<'a, 'b, E, R> AsRef<Handle<'a, E, R>> for ModificationScope<'a, 'b, E, R> where
E: Entry,
R: Receiver<E>,
[src]
E: Entry,
R: Receiver<E>,
impl<'a, 'b, E, R> Debug for ModificationScope<'a, 'b, E, R> where
E: Entry,
E::Data: Debug,
R: Receiver<E> + Debug,
[src]
E: Entry,
E::Data: Debug,
R: Receiver<E> + Debug,
impl<'a, 'b, E, R> Deref for ModificationScope<'a, 'b, E, R> where
E: Entry,
R: Receiver<E>,
[src]
E: Entry,
R: Receiver<E>,
impl<'a, 'b, E, R> DerefMut for ModificationScope<'a, 'b, E, R> where
E: Entry,
R: Receiver<E>,
[src]
E: Entry,
R: Receiver<E>,
impl<'a, 'b, E, R> Drop for ModificationScope<'a, 'b, E, R> where
E: Entry,
R: Receiver<E>,
[src]
E: Entry,
R: Receiver<E>,
Auto Trait Implementations
impl<'a, 'b, E, R> RefUnwindSafe for ModificationScope<'a, 'b, E, R> where
E: RefUnwindSafe,
R: RefUnwindSafe,
<E as Entry>::Data: RefUnwindSafe,
E: RefUnwindSafe,
R: RefUnwindSafe,
<E as Entry>::Data: RefUnwindSafe,
impl<'a, 'b, E, R> Send for ModificationScope<'a, 'b, E, R> where
E: Send,
R: Send,
<E as Entry>::Data: Send,
E: Send,
R: Send,
<E as Entry>::Data: Send,
impl<'a, 'b, E, R> Sync for ModificationScope<'a, 'b, E, R> where
E: Sync,
R: Sync,
<E as Entry>::Data: Sync,
E: Sync,
R: Sync,
<E as Entry>::Data: Sync,
impl<'a, 'b, E, R> Unpin for ModificationScope<'a, 'b, E, R> where
'a: 'b,
'a: 'b,
impl<'a, 'b, E, R> !UnwindSafe for ModificationScope<'a, 'b, E, R>
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,