pub struct ReadOnlyPrefixedState<'a> { /* private fields */ }Expand description
A borrowed, read-only view of state that automatically prepends a prefix to all keys.
Unlike PrefixedState, this does not expose set() or remove() methods,
making it suitable for computed/derived state that user code should not mutate.
Implementations§
Source§impl<'a> ReadOnlyPrefixedState<'a>
impl<'a> ReadOnlyPrefixedState<'a>
Sourcepub fn get<T: DeserializeOwned>(&self, key: &str) -> Option<T>
pub fn get<T: DeserializeOwned>(&self, key: &str) -> Option<T>
Get a value by key (with prefix applied).
Sourcepub fn get_raw(&self, key: &str) -> Option<Value>
pub fn get_raw(&self, key: &str) -> Option<Value>
Get a raw JSON value by key (with prefix applied).
Auto Trait Implementations§
impl<'a> Freeze for ReadOnlyPrefixedState<'a>
impl<'a> !RefUnwindSafe for ReadOnlyPrefixedState<'a>
impl<'a> Send for ReadOnlyPrefixedState<'a>
impl<'a> Sync for ReadOnlyPrefixedState<'a>
impl<'a> Unpin for ReadOnlyPrefixedState<'a>
impl<'a> UnsafeUnpin for ReadOnlyPrefixedState<'a>
impl<'a> !UnwindSafe for ReadOnlyPrefixedState<'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