[−][src]Trait structural::field::rev_get_field::RevGetFieldMut
A trait alias for an infallible RevGetFieldMutImpl
,
generally used to access fields in structs(not in a nested enum inside the struct).
This
is the type we are accessing,and Self
is a field path.
Example
This example shows how to access a nested struct field by mutable reference.
use structural::field::RevGetFieldMut; use structural::for_examples::{StructFoo, StructBar, Struct3}; use structural::{StructuralExt,FP,fp}; let mut struct_=Struct3{ foo: Some(0), bar: "hi", baz: StructBar{ bar: StructFoo{ foo:101, }, }, }; assert_eq!( get_nested(&mut struct_), &mut 101 ); fn get_nested<'a,T>(this:&'a mut T)->&'a mut i32 where FP!(baz.bar.foo): RevGetFieldMut<'a,T,Ty=i32> { this.field_mut(fp!(baz.bar.foo)) }
Implementors
impl<'a, Path, This> RevGetFieldMut<'a, This> for Path where
Path: RevGetFieldMutImpl<'a, This, Err = InfallibleAccess>,
[src]
Path: RevGetFieldMutImpl<'a, This, Err = InfallibleAccess>,