pub struct Shared<T> { /* private fields */ }Expand description
Ref-counted shared value with change notification (UDF Shared engine subset).
Implementations§
pub fn new(value: T) -> Self
pub fn with<R>(&self, f: impl FnOnce(&T) -> R) -> R
pub fn with_mut<R>(&self, f: impl FnOnce(&mut T) -> R) -> R
pub fn set(&self, value: T)where
T: PartialEq,
pub fn get(&self) -> Twhere
T: Clone,
pub fn load<S>(storage: &S, key: &str, default: T) -> Result<Self, StorageError>where
S: Storage<T>,
pub fn persist<S>(&self, storage: &S, key: &str) -> Result<(), StorageError>
pub fn subscribe(&self) -> SharedSubscriber<T>
Trait Implementations§
Auto Trait Implementations§
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