pub struct ArcRwLockKeyPathChain<Root, RwLockValue, InnerValue, SubValue, F, G>{ /* private fields */ }Expand description
A composed keypath chain through Arc<RwLock
§Example
// Functional style: compose first, then apply container at get()
ContainerTest::rwlock_data_r()
.chain_arc_rwlock_at_kp(SomeStruct::data_r())
.get(&container, |value| println!("Value: {}", value));Implementations§
Source§impl<Root, RwLockValue, InnerValue, SubValue, F, G> ArcRwLockKeyPathChain<Root, RwLockValue, InnerValue, SubValue, F, G>where
F: for<'r> Fn(&'r Root) -> &'r RwLockValue,
G: for<'r> Fn(&'r InnerValue) -> &'r SubValue,
RwLockValue: Borrow<Arc<RwLock<InnerValue>>>,
impl<Root, RwLockValue, InnerValue, SubValue, F, G> ArcRwLockKeyPathChain<Root, RwLockValue, InnerValue, SubValue, F, G>where
F: for<'r> Fn(&'r Root) -> &'r RwLockValue,
G: for<'r> Fn(&'r InnerValue) -> &'r SubValue,
RwLockValue: Borrow<Arc<RwLock<InnerValue>>>,
Sourcepub fn get<Callback>(self, container: &Root, callback: Callback) -> Option<()>
pub fn get<Callback>(self, container: &Root, callback: Callback) -> Option<()>
Apply the composed keypath chain to a container, executing callback with the value (read lock) Consumes self - functional style (compose once, apply once)
Sourcepub fn then<NextValue, H>(
self,
next: KeyPath<SubValue, NextValue, H>,
) -> ArcRwLockKeyPathChain<Root, RwLockValue, InnerValue, NextValue, F, impl for<'r> Fn(&'r InnerValue) + 'static>where
H: for<'r> Fn(&'r SubValue) -> &'r NextValue + 'static,
G: 'static,
InnerValue: 'static,
SubValue: 'static,
NextValue: 'static,
pub fn then<NextValue, H>(
self,
next: KeyPath<SubValue, NextValue, H>,
) -> ArcRwLockKeyPathChain<Root, RwLockValue, InnerValue, NextValue, F, impl for<'r> Fn(&'r InnerValue) + 'static>where
H: for<'r> Fn(&'r SubValue) -> &'r NextValue + 'static,
G: 'static,
InnerValue: 'static,
SubValue: 'static,
NextValue: 'static,
Chain with another readable keypath through another level
This allows composing deeper keypaths through the same Arc<RwLock
Sourcepub fn chain_optional<NextValue, H>(
self,
next: OptionalKeyPath<SubValue, NextValue, H>,
) -> ArcRwLockOptionalKeyPathChain<Root, RwLockValue, InnerValue, NextValue, F, impl for<'r> Fn(&'r InnerValue) + 'static>where
H: for<'r> Fn(&'r SubValue) -> Option<&'r NextValue> + 'static,
G: 'static,
InnerValue: 'static,
SubValue: 'static,
NextValue: 'static,
pub fn chain_optional<NextValue, H>(
self,
next: OptionalKeyPath<SubValue, NextValue, H>,
) -> ArcRwLockOptionalKeyPathChain<Root, RwLockValue, InnerValue, NextValue, F, impl for<'r> Fn(&'r InnerValue) + 'static>where
H: for<'r> Fn(&'r SubValue) -> Option<&'r NextValue> + 'static,
G: 'static,
InnerValue: 'static,
SubValue: 'static,
NextValue: 'static,
Chain with an optional readable keypath through another level
Auto Trait Implementations§
impl<Root, RwLockValue, InnerValue, SubValue, F, G> Freeze for ArcRwLockKeyPathChain<Root, RwLockValue, InnerValue, SubValue, F, G>
impl<Root, RwLockValue, InnerValue, SubValue, F, G> RefUnwindSafe for ArcRwLockKeyPathChain<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 ArcRwLockKeyPathChain<Root, RwLockValue, InnerValue, SubValue, F, G>
impl<Root, RwLockValue, InnerValue, SubValue, F, G> Sync for ArcRwLockKeyPathChain<Root, RwLockValue, InnerValue, SubValue, F, G>
impl<Root, RwLockValue, InnerValue, SubValue, F, G> Unpin for ArcRwLockKeyPathChain<Root, RwLockValue, InnerValue, SubValue, F, G>
impl<Root, RwLockValue, InnerValue, SubValue, F, G> UnwindSafe for ArcRwLockKeyPathChain<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