pub struct WritableKeyPath<Root, Value, F>{ /* private fields */ }Implementations§
Source§impl<Root, Value, F> WritableKeyPath<Root, Value, F>
impl<Root, Value, F> WritableKeyPath<Root, Value, F>
pub fn new(getter: F) -> WritableKeyPath<Root, Value, F>
pub fn get_mut<'r>(&self, root: &'r mut Root) -> &'r mut Value
Sourcepub fn for_result<E>(
self,
) -> WritableOptionalKeyPath<Result<Root, E>, Value, impl for<'r> Fn(&'r mut Result<Root, E>) + 'static>where
F: 'static,
Root: 'static,
Value: 'static,
E: 'static,
pub fn for_result<E>(
self,
) -> WritableOptionalKeyPath<Result<Root, E>, Value, impl for<'r> Fn(&'r mut Result<Root, E>) + 'static>where
F: 'static,
Root: 'static,
Value: 'static,
E: 'static,
Adapt this keypath to work with Result<Root, E> instead of Root This unwraps the Result and applies the keypath to the Ok value
pub fn for_box_root(
self,
) -> WritableKeyPath<Box<Root>, Value, impl for<'r> Fn(&'r mut Box<Root>) + 'static>where
F: 'static,
Root: 'static,
Value: 'static,
Sourcepub fn for_option(
self,
) -> WritableOptionalKeyPath<Option<Root>, Value, impl for<'r> Fn(&'r mut Option<Root>) + 'static>where
F: 'static,
Root: 'static,
Value: 'static,
pub fn for_option(
self,
) -> WritableOptionalKeyPath<Option<Root>, Value, impl for<'r> Fn(&'r mut Option<Root>) + 'static>where
F: 'static,
Root: 'static,
Value: 'static,
Adapt this keypath to work with Option
Sourcepub fn to_optional(
self,
) -> WritableOptionalKeyPath<Root, Value, impl for<'r> Fn(&'r mut Root) + 'static>where
F: 'static,
pub fn to_optional(
self,
) -> WritableOptionalKeyPath<Root, Value, impl for<'r> Fn(&'r mut Root) + 'static>where
F: 'static,
Convert a WritableKeyPath to WritableOptionalKeyPath for chaining This allows non-optional writable keypaths to be chained with then()
pub fn for_box<Target>(
self,
) -> WritableKeyPath<Root, Target, impl for<'r> Fn(&'r mut Root) + 'static>where
Value: DerefMut<Target = Target> + 'static,
F: 'static,
pub fn for_arc<Target>(
self,
) -> WritableKeyPath<Root, Target, impl for<'r> Fn(&'r mut Root) + 'static>where
Value: DerefMut<Target = Target> + 'static,
F: 'static,
pub fn for_rc<Target>(
self,
) -> WritableKeyPath<Root, Target, impl for<'r> Fn(&'r mut Root) + 'static>where
Value: DerefMut<Target = Target> + 'static,
F: 'static,
Sourcepub fn with_box_mut<Callback, R>(&self, boxed: &mut Box<Root>, f: Callback) -> R
pub fn with_box_mut<Callback, R>(&self, boxed: &mut Box<Root>, f: Callback) -> R
Execute a closure with a mutable reference to the value inside a Box
Sourcepub fn with_result_mut<Callback, R, E>(
&self,
result: &mut Result<Root, E>,
f: Callback,
) -> Option<R>
pub fn with_result_mut<Callback, R, E>( &self, result: &mut Result<Root, E>, f: Callback, ) -> Option<R>
Execute a closure with a mutable reference to the value inside a Result
Sourcepub fn with_option_mut<Callback, R>(
&self,
option: &mut Option<Root>,
f: Callback,
) -> Option<R>
pub fn with_option_mut<Callback, R>( &self, option: &mut Option<Root>, f: Callback, ) -> Option<R>
Execute a closure with a mutable reference to the value inside an Option
Sourcepub fn with_refcell_mut<Callback, R>(
&self,
refcell: &RefCell<Root>,
f: Callback,
) -> Option<R>
pub fn with_refcell_mut<Callback, R>( &self, refcell: &RefCell<Root>, f: Callback, ) -> Option<R>
Execute a closure with a mutable reference to the value inside a RefCell
Sourcepub fn with_mutex_mut<Callback, R>(
&self,
mutex: &mut Mutex<Root>,
f: Callback,
) -> Option<R>
pub fn with_mutex_mut<Callback, R>( &self, mutex: &mut Mutex<Root>, f: Callback, ) -> Option<R>
Execute a closure with a mutable reference to the value inside a Mutex
Sourcepub fn with_rwlock_mut<Callback, R>(
&self,
rwlock: &mut RwLock<Root>,
f: Callback,
) -> Option<R>
pub fn with_rwlock_mut<Callback, R>( &self, rwlock: &mut RwLock<Root>, f: Callback, ) -> Option<R>
Execute a closure with a mutable reference to the value inside an RwLock
Sourcepub fn iter_mut<'r, T>(&self, root: &'r mut Root) -> Option<IterMut<'r, T>>
pub fn iter_mut<'r, T>(&self, root: &'r mut Root) -> Option<IterMut<'r, T>>
Get a mutable iterator over a Vec when Value is Vec
Sourcepub fn extract_mut_from_slice<'r>(
&self,
slice: &'r mut [Root],
) -> Vec<&'r mut Value>
pub fn extract_mut_from_slice<'r>( &self, slice: &'r mut [Root], ) -> Vec<&'r mut Value>
Extract mutable values from a slice of owned mutable values Returns a Vec of mutable references to the extracted values
Sourcepub fn extract_mut_from_ref_slice<'r>(
&self,
slice: &'r mut [&'r mut Root],
) -> Vec<&'r mut Value>
pub fn extract_mut_from_ref_slice<'r>( &self, slice: &'r mut [&'r mut Root], ) -> Vec<&'r mut Value>
Extract mutable values from a slice of mutable references Returns a Vec of mutable references to the extracted values
Sourcepub fn then<SubValue, G>(
self,
next: WritableKeyPath<Value, SubValue, G>,
) -> WritableKeyPath<Root, SubValue, impl for<'r> Fn(&'r mut Root)>
pub fn then<SubValue, G>( self, next: WritableKeyPath<Value, SubValue, G>, ) -> WritableKeyPath<Root, SubValue, impl for<'r> Fn(&'r mut Root)>
Chain this keypath with another writable keypath Returns a WritableKeyPath that chains both keypaths
Sourcepub fn then_optional<SubValue, G>(
self,
next: WritableOptionalKeyPath<Value, SubValue, G>,
) -> WritableOptionalKeyPath<Root, SubValue, impl for<'r> Fn(&'r mut Root)>where
G: for<'r> Fn(&'r mut Value) -> Option<&'r mut SubValue> + 'static,
F: 'static,
Value: 'static,
pub fn then_optional<SubValue, G>(
self,
next: WritableOptionalKeyPath<Value, SubValue, G>,
) -> WritableOptionalKeyPath<Root, SubValue, impl for<'r> Fn(&'r mut Root)>where
G: for<'r> Fn(&'r mut Value) -> Option<&'r mut SubValue> + 'static,
F: 'static,
Value: 'static,
Chain this keypath with a writable optional keypath Returns a WritableOptionalKeyPath that chains both keypaths
Source§impl<Root, Value, F> WritableKeyPath<Root, Value, F>
impl<Root, Value, F> WritableKeyPath<Root, Value, F>
Sourcepub fn to_partial(self) -> PartialWritableKeyPath<Root>
pub fn to_partial(self) -> PartialWritableKeyPath<Root>
Convert to PartialWritableKeyPath (hides Value type)
Sourcepub fn to(self) -> PartialWritableKeyPath<Root>
pub fn to(self) -> PartialWritableKeyPath<Root>
Alias for to_partial() - converts to PartialWritableKeyPath
Trait Implementations§
Source§impl<Root, Value, F> Clone for WritableKeyPath<Root, Value, F>
impl<Root, Value, F> Clone for WritableKeyPath<Root, Value, F>
Source§fn clone(&self) -> WritableKeyPath<Root, Value, F>
fn clone(&self) -> WritableKeyPath<Root, Value, F>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more