[−][src]Trait structural::field::rev_get_field::OptRevGetFieldMut
A trait alias for a fallible RevGetFieldMutImpl
,
generally used to access fields inside enums.
This
is the type we are accessing,and Self
is a field path.
Example
This example shows how you can access an enum field by mutable reference.
use structural::field::OptRevGetFieldMut; 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:Some("hello"), }, }, }; assert_eq!( get_nested(&mut struct_), Some(&mut "hello") ); fn get_nested<'a,T>(this:&'a mut T)->Option<&'a mut &'static str> where FP!(baz.bar.foo?): OptRevGetFieldMut<'a,T,Ty=&'static str> { this.field_mut(fp!(baz.bar.foo?)) }
Implementors
impl<'a, Path, This> OptRevGetFieldMut<'a, This> for Path where
Path: RevGetFieldMutImpl<'a, This, Err = FailedAccess>,
[src]
Path: RevGetFieldMutImpl<'a, This, Err = FailedAccess>,