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

pub trait RevIntoField<This>: RevIntoFieldImpl<This, Err = InfallibleAccess> { }

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

use structural::field::RevIntoField;
use structural::for_examples::StructBar;
use structural::{StructuralExt,FP,fp};

use std::cmp::Ordering;

let struct_=StructBar{
    bar: StructBar{
        bar: StructBar{
            bar: Ordering::Greater
        },
    },
};

assert_eq!( get_nested(struct_), Ordering::Greater );

fn get_nested<T>(this:T)->Ordering
where
    FP!(bar.bar.bar): RevIntoField<T,Ty=Ordering>
{
    this.into_field(fp!(bar.bar.bar))
}

Implementors

impl<Path, This> RevIntoField<This> for Path where
    Path: RevIntoFieldImpl<This, Err = InfallibleAccess>, 
[src]

Loading content...