[][src]Trait structural::field::rev_get_field::RevGetField

pub trait RevGetField<'a, This>: RevGetFieldImpl<'a, This, Err = InfallibleAccess> { }

A trait alias for an infallible RevGetFieldImpl, 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 reference.

use structural::field::RevGetField;
use structural::{StructuralExt,FP,fp};


let tup=(3,5,(8,(13,21)));
assert_eq!( get_nested(&tup), &13 );

fn get_nested<'a,T>(this:&'a T)->&'a i32
where
    FP!(2.1.0): RevGetField<'a,T,Ty=i32>
{
    this.field_(fp!(2.1.0))
}

Implementors

impl<'a, Path, This> RevGetField<'a, This> for Path where
    Path: RevGetFieldImpl<'a, This, Err = InfallibleAccess>, 
[src]

Loading content...