pub struct ProjectedBinding<Root: 'static, Focus: 'static, SK> { /* private fields */ }Expand description
A field projected from a StateBinding through a keypath.
Implementations§
Source§impl<Root, Focus, SK> ProjectedBinding<Root, Focus, SK>where
Root: 'static,
Focus: 'static,
SK: RefKpTrait<Root, Focus>,
impl<Root, Focus, SK> ProjectedBinding<Root, Focus, SK>where
Root: 'static,
Focus: 'static,
SK: RefKpTrait<Root, Focus>,
Sourcepub fn with<R>(&self, f: impl FnOnce(&Focus) -> R) -> Option<R>
pub fn with<R>(&self, f: impl FnOnce(&Focus) -> R) -> Option<R>
Borrow the focused value under the root lock, or None if the keypath misses.
Sourcepub fn with_mut<R>(&self, f: impl FnOnce(&mut Focus) -> R) -> Option<R>
pub fn with_mut<R>(&self, f: impl FnOnce(&mut Focus) -> R) -> Option<R>
Mutably borrow the focused value under the root lock, or None if the keypath misses.
Sourcepub fn project<V, SubSK>(
self,
sub_kp: SubSK,
) -> ComposedBinding<Root, Focus, V, SK, SubSK>where
SubSK: RefKpTrait<Focus, V>,
SK: Clone,
pub fn project<V, SubSK>(
self,
sub_kp: SubSK,
) -> ComposedBinding<Root, Focus, V, SK, SubSK>where
SubSK: RefKpTrait<Focus, V>,
SK: Clone,
Chain another keypath segment (consumes self; parent keypath must be Clone).
Trait Implementations§
Source§impl<Root, Focus, SK> Clone for ProjectedBinding<Root, Focus, SK>where
Root: 'static,
Focus: 'static,
SK: RefKpTrait<Root, Focus> + Clone,
impl<Root, Focus, SK> Clone for ProjectedBinding<Root, Focus, SK>where
Root: 'static,
Focus: 'static,
SK: RefKpTrait<Root, Focus> + Clone,
Auto Trait Implementations§
impl<Root, Focus, SK> !RefUnwindSafe for ProjectedBinding<Root, Focus, SK>
impl<Root, Focus, SK> !UnwindSafe for ProjectedBinding<Root, Focus, SK>
impl<Root, Focus, SK> Freeze for ProjectedBinding<Root, Focus, SK>where
SK: Freeze,
impl<Root, Focus, SK> Send for ProjectedBinding<Root, Focus, SK>
impl<Root, Focus, SK> Sync for ProjectedBinding<Root, Focus, SK>
impl<Root, Focus, SK> Unpin for ProjectedBinding<Root, Focus, SK>
impl<Root, Focus, SK> UnsafeUnpin for ProjectedBinding<Root, Focus, SK>where
SK: UnsafeUnpin,
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