pub struct ArcRwLockWritableKeyPathChain<Root, RwLockValue, InnerValue, SubValue, F, G>where
F: for<'r> Fn(&'r Root) -> &'r RwLockValue,
G: for<'r> Fn(&'r mut InnerValue) -> &'r mut SubValue,{ /* private fields */ }Expand description
A composed writable keypath chain through Arc<RwLock
Implementations§
Source§impl<Root, RwLockValue, InnerValue, SubValue, F, G> ArcRwLockWritableKeyPathChain<Root, RwLockValue, InnerValue, SubValue, F, G>where
F: for<'r> Fn(&'r Root) -> &'r RwLockValue,
G: for<'r> Fn(&'r mut InnerValue) -> &'r mut SubValue,
RwLockValue: Borrow<Arc<RwLock<InnerValue>>>,
impl<Root, RwLockValue, InnerValue, SubValue, F, G> ArcRwLockWritableKeyPathChain<Root, RwLockValue, InnerValue, SubValue, F, G>where
F: for<'r> Fn(&'r Root) -> &'r RwLockValue,
G: for<'r> Fn(&'r mut InnerValue) -> &'r mut SubValue,
RwLockValue: Borrow<Arc<RwLock<InnerValue>>>,
Sourcepub fn get_mut<Callback, R>(
self,
container: &Root,
callback: Callback,
) -> Option<R>where
Callback: FnOnce(&mut SubValue) -> R,
pub fn get_mut<Callback, R>(
self,
container: &Root,
callback: Callback,
) -> Option<R>where
Callback: FnOnce(&mut SubValue) -> R,
Apply the composed keypath chain to a container with mutable access (write lock) Consumes self - functional style (compose once, apply once)
Sourcepub fn then<NextValue, H>(
self,
next: WritableKeyPath<SubValue, NextValue, H>,
) -> ArcRwLockWritableKeyPathChain<Root, RwLockValue, InnerValue, NextValue, F, impl for<'r> Fn(&'r mut InnerValue) + 'static>where
H: for<'r> Fn(&'r mut SubValue) -> &'r mut NextValue + 'static,
G: 'static,
InnerValue: 'static,
SubValue: 'static,
NextValue: 'static,
pub fn then<NextValue, H>(
self,
next: WritableKeyPath<SubValue, NextValue, H>,
) -> ArcRwLockWritableKeyPathChain<Root, RwLockValue, InnerValue, NextValue, F, impl for<'r> Fn(&'r mut InnerValue) + 'static>where
H: for<'r> Fn(&'r mut SubValue) -> &'r mut NextValue + 'static,
G: 'static,
InnerValue: 'static,
SubValue: 'static,
NextValue: 'static,
Monadic composition: chain with another writable keypath
This allows composing deeper keypaths through the same Arc<RwLock
§Example
ⓘ
// Compose: Root -> Arc<RwLock<InnerValue>> -> InnerValue -> SubValue -> NextValue
let chain = root_keypath
.chain_arc_rwlock_writable_at_kp(inner_keypath)
.then(next_keypath);Sourcepub fn chain_optional<NextValue, H>(
self,
next: WritableOptionalKeyPath<SubValue, NextValue, H>,
) -> ArcRwLockWritableOptionalKeyPathChain<Root, RwLockValue, InnerValue, NextValue, F, impl for<'r> Fn(&'r mut InnerValue) + 'static>where
H: for<'r> Fn(&'r mut SubValue) -> Option<&'r mut NextValue> + 'static,
G: 'static,
InnerValue: 'static,
SubValue: 'static,
NextValue: 'static,
pub fn chain_optional<NextValue, H>(
self,
next: WritableOptionalKeyPath<SubValue, NextValue, H>,
) -> ArcRwLockWritableOptionalKeyPathChain<Root, RwLockValue, InnerValue, NextValue, F, impl for<'r> Fn(&'r mut InnerValue) + 'static>where
H: for<'r> Fn(&'r mut SubValue) -> Option<&'r mut NextValue> + 'static,
G: 'static,
InnerValue: 'static,
SubValue: 'static,
NextValue: 'static,
Monadic composition: chain with a writable optional keypath (for Option fields)
This allows composing through Option types within the same Arc<RwLock
§Example
ⓘ
// Compose: Root -> Arc<RwLock<InnerValue>> -> InnerValue -> Option<SubValue> -> NextValue
let chain = root_keypath
.chain_arc_rwlock_writable_at_kp(inner_keypath)
.chain_optional(optional_keypath);Auto Trait Implementations§
impl<Root, RwLockValue, InnerValue, SubValue, F, G> Freeze for ArcRwLockWritableKeyPathChain<Root, RwLockValue, InnerValue, SubValue, F, G>
impl<Root, RwLockValue, InnerValue, SubValue, F, G> RefUnwindSafe for ArcRwLockWritableKeyPathChain<Root, RwLockValue, InnerValue, SubValue, F, G>where
F: RefUnwindSafe,
G: RefUnwindSafe,
Root: RefUnwindSafe,
RwLockValue: RefUnwindSafe,
InnerValue: RefUnwindSafe,
SubValue: RefUnwindSafe,
impl<Root, RwLockValue, InnerValue, SubValue, F, G> Send for ArcRwLockWritableKeyPathChain<Root, RwLockValue, InnerValue, SubValue, F, G>
impl<Root, RwLockValue, InnerValue, SubValue, F, G> Sync for ArcRwLockWritableKeyPathChain<Root, RwLockValue, InnerValue, SubValue, F, G>
impl<Root, RwLockValue, InnerValue, SubValue, F, G> Unpin for ArcRwLockWritableKeyPathChain<Root, RwLockValue, InnerValue, SubValue, F, G>
impl<Root, RwLockValue, InnerValue, SubValue, F, G> UnwindSafe for ArcRwLockWritableKeyPathChain<Root, RwLockValue, InnerValue, SubValue, F, G>where
F: UnwindSafe,
G: UnwindSafe,
Root: UnwindSafe,
RwLockValue: UnwindSafe,
InnerValue: UnwindSafe,
SubValue: UnwindSafe,
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