Struct frame_support::storage::storage_noop_guard::StorageNoopGuard
source · pub struct StorageNoopGuard<'a> { /* private fields */ }
Expand description
Asserts that no storage changes took place between con- and destruction of Self
.
This is easier than wrapping the whole code-block inside a assert_storage_noop!
.
§Example
ⓘ
use frame_support::{StorageNoopGuard, storage::unhashed::put};
sp_io::TestExternalities::default().execute_with(|| {
let _guard = frame_support::StorageNoopGuard::default();
put(b"key", b"value");
// Panics since there are storage changes.
});
Implementations§
source§impl<'a> StorageNoopGuard<'a>
impl<'a> StorageNoopGuard<'a>
sourcepub fn from_error_message(error_message: &'a str) -> Self
pub fn from_error_message(error_message: &'a str) -> Self
Creates a new StorageNoopGuard
with a custom error message.
sourcepub fn set_error_message(&mut self, error_message: &'a str)
pub fn set_error_message(&mut self, error_message: &'a str)
Sets a custom error message for a StorageNoopGuard
.
Trait Implementations§
source§impl<'a> Default for StorageNoopGuard<'a>
impl<'a> Default for StorageNoopGuard<'a>
Auto Trait Implementations§
impl<'a> RefUnwindSafe for StorageNoopGuard<'a>
impl<'a> Send for StorageNoopGuard<'a>
impl<'a> Sync for StorageNoopGuard<'a>
impl<'a> Unpin for StorageNoopGuard<'a>
impl<'a> UnwindSafe for StorageNoopGuard<'a>
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
source§impl<T> CheckedConversion for T
impl<T> CheckedConversion for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T, Outer> IsWrappedBy<Outer> for T
impl<T, Outer> IsWrappedBy<Outer> for T
source§impl<T> SaturatedConversion for T
impl<T> SaturatedConversion for T
source§fn saturated_from<T>(t: T) -> Selfwhere
Self: UniqueSaturatedFrom<T>,
fn saturated_from<T>(t: T) -> Selfwhere
Self: UniqueSaturatedFrom<T>,
source§fn saturated_into<T>(self) -> Twhere
Self: UniqueSaturatedInto<T>,
fn saturated_into<T>(self) -> Twhere
Self: UniqueSaturatedInto<T>,
Consume self to return an equivalent value of
T
. Read moresource§impl<S, T> UncheckedInto<T> for Swhere
T: UncheckedFrom<S>,
impl<S, T> UncheckedInto<T> for Swhere
T: UncheckedFrom<S>,
source§fn unchecked_into(self) -> T
fn unchecked_into(self) -> T
The counterpart to
unchecked_from
.source§impl<T, S> UniqueSaturatedInto<T> for S
impl<T, S> UniqueSaturatedInto<T> for S
source§fn unique_saturated_into(self) -> T
fn unique_saturated_into(self) -> T
Consume self to return an equivalent value of
T
.