[][src]Trait structural::field_traits::IntoField

pub trait IntoField<FieldName>: GetField<FieldName> {
    fn into_field_(self) -> Self::Ty
    where
        Self: Sized
;
fn box_into_field_(self: Box<Self>) -> Self::Ty; }

Converts this type into its FieldName field.

Usage as Bound Example

This example demonstrates how you can use this trait as a bound.

If you have a lot of field accessor bounds you could use structural_alias macro to alias those bounds and use that alias instead.

use structural::{IntoField,GetFieldExt,GetFieldType,FP,fp};
 
fn into_value<T,V>(this:T)->V
where
    // `FP!(v a l u e)` can be written as `FP!(value)` from 1.40 onwards
    T:IntoField<FP!(v a l u e), Ty=V>,
{
    this.into_field(fp!(value))
}

#[derive(structural::Structural)]
struct Huh<T>{
    #[struc(access="move")]
    value:T,
}
 
fn main(){
    let this=Huh{value:"Hello, World!"};
    assert_eq!(into_value(this),"Hello, World!");
}
 

Manual Implementation Example

While this trait is intended to be implemented using the Structural derive macro, you can manually implement it like this:

use structural::{
    GetField,IntoField,Structural,FP,TList,
    structural_trait::{FieldInfo},
    mut_ref::MutRef,
    z_impl_structural_dyn,
};

struct Huh<T>{
    value:T,
}


impl<T> Structural for Huh<T>{
    const FIELDS:&'static[FieldInfo]=&[FieldInfo::not_renamed("value")];

}

z_impl_structural_dyn!{ impl[T] Huh<T> }

// `FP!(v a l u e)` can be written as `FP!(value)` from 1.40 onwards
impl<T> GetField<FP!(v a l u e)> for Huh<T>{
    type Ty=T;

    fn get_field_(&self)->&Self::Ty{
        &self.value
    }
}

// `FP!(v a l u e)` can be written as `FP!(value)` from 1.40 onwards
impl<T> IntoField<FP!(v a l u e)> for Huh<T>{
    fn into_field_(self)->Self::Ty{
        self.value
    }

    structural::z_impl_box_into_field_method!{FP!(v a l u e)}
}

Required methods

fn into_field_(self) -> Self::Ty where
    Self: Sized

Converts self into the field.

fn box_into_field_(self: Box<Self>) -> Self::Ty

Converts a boxed self into the field.

Loading content...

Implementations on Foreign Types

impl<T, P> IntoField<P> for [T; 0] where
    P: IsPathForArray<Self>, 
[src]

impl<T, P> IntoField<P> for [T; 1] where
    P: IsPathForArray<Self>, 
[src]

impl<T, P> IntoField<P> for [T; 2] where
    P: IsPathForArray<Self>, 
[src]

impl<T, P> IntoField<P> for [T; 3] where
    P: IsPathForArray<Self>, 
[src]

impl<T, P> IntoField<P> for [T; 4] where
    P: IsPathForArray<Self>, 
[src]

impl<T, P> IntoField<P> for [T; 5] where
    P: IsPathForArray<Self>, 
[src]

impl<T, P> IntoField<P> for [T; 6] where
    P: IsPathForArray<Self>, 
[src]

impl<T, P> IntoField<P> for [T; 7] where
    P: IsPathForArray<Self>, 
[src]

impl<T, P> IntoField<P> for [T; 8] where
    P: IsPathForArray<Self>, 
[src]

impl<T, P> IntoField<P> for [T; 9] where
    P: IsPathForArray<Self>, 
[src]

impl<T, P> IntoField<P> for [T; 10] where
    P: IsPathForArray<Self>, 
[src]

impl<T, P> IntoField<P> for [T; 11] where
    P: IsPathForArray<Self>, 
[src]

impl<T, P> IntoField<P> for [T; 12] where
    P: IsPathForArray<Self>, 
[src]

impl<T, P> IntoField<P> for [T; 13] where
    P: IsPathForArray<Self>, 
[src]

impl<T, P> IntoField<P> for [T; 14] where
    P: IsPathForArray<Self>, 
[src]

impl<T, P> IntoField<P> for [T; 15] where
    P: IsPathForArray<Self>, 
[src]

impl<T, P> IntoField<P> for [T; 16] where
    P: IsPathForArray<Self>, 
[src]

impl<T, P> IntoField<P> for [T; 17] where
    P: IsPathForArray<Self>, 
[src]

impl<T, P> IntoField<P> for [T; 18] where
    P: IsPathForArray<Self>, 
[src]

impl<T, P> IntoField<P> for [T; 19] where
    P: IsPathForArray<Self>, 
[src]

impl<T, P> IntoField<P> for [T; 20] where
    P: IsPathForArray<Self>, 
[src]

impl<T, P> IntoField<P> for [T; 21] where
    P: IsPathForArray<Self>, 
[src]

impl<T, P> IntoField<P> for [T; 22] where
    P: IsPathForArray<Self>, 
[src]

impl<T, P> IntoField<P> for [T; 23] where
    P: IsPathForArray<Self>, 
[src]

impl<T, P> IntoField<P> for [T; 24] where
    P: IsPathForArray<Self>, 
[src]

impl<T, P> IntoField<P> for [T; 25] where
    P: IsPathForArray<Self>, 
[src]

impl<T, P> IntoField<P> for [T; 26] where
    P: IsPathForArray<Self>, 
[src]

impl<T, P> IntoField<P> for [T; 27] where
    P: IsPathForArray<Self>, 
[src]

impl<T, P> IntoField<P> for [T; 28] where
    P: IsPathForArray<Self>, 
[src]

impl<T, P> IntoField<P> for [T; 29] where
    P: IsPathForArray<Self>, 
[src]

impl<T, P> IntoField<P> for [T; 30] where
    P: IsPathForArray<Self>, 
[src]

impl<T, P> IntoField<P> for [T; 31] where
    P: IsPathForArray<Self>, 
[src]

impl<T, P> IntoField<P> for [T; 32] where
    P: IsPathForArray<Self>, 
[src]

impl<C0> IntoField<FieldPath<(TString<(_0,)>,)>> for (C0,)[src]

impl<C0, C1> IntoField<FieldPath<(TString<(_0,)>,)>> for (C0, C1)[src]

impl<C0, C1> IntoField<FieldPath<(TString<(_1,)>,)>> for (C0, C1)[src]

impl<C0, C1, C2> IntoField<FieldPath<(TString<(_0,)>,)>> for (C0, C1, C2)[src]

impl<C0, C1, C2> IntoField<FieldPath<(TString<(_1,)>,)>> for (C0, C1, C2)[src]

impl<C0, C1, C2> IntoField<FieldPath<(TString<(_2,)>,)>> for (C0, C1, C2)[src]

impl<C0, C1, C2, C3> IntoField<FieldPath<(TString<(_0,)>,)>> for (C0, C1, C2, C3)[src]

impl<C0, C1, C2, C3> IntoField<FieldPath<(TString<(_1,)>,)>> for (C0, C1, C2, C3)[src]

impl<C0, C1, C2, C3> IntoField<FieldPath<(TString<(_2,)>,)>> for (C0, C1, C2, C3)[src]

impl<C0, C1, C2, C3> IntoField<FieldPath<(TString<(_3,)>,)>> for (C0, C1, C2, C3)[src]

impl<C0, C1, C2, C3, C4> IntoField<FieldPath<(TString<(_0,)>,)>> for (C0, C1, C2, C3, C4)[src]

impl<C0, C1, C2, C3, C4> IntoField<FieldPath<(TString<(_1,)>,)>> for (C0, C1, C2, C3, C4)[src]

impl<C0, C1, C2, C3, C4> IntoField<FieldPath<(TString<(_2,)>,)>> for (C0, C1, C2, C3, C4)[src]

impl<C0, C1, C2, C3, C4> IntoField<FieldPath<(TString<(_3,)>,)>> for (C0, C1, C2, C3, C4)[src]

impl<C0, C1, C2, C3, C4> IntoField<FieldPath<(TString<(_4,)>,)>> for (C0, C1, C2, C3, C4)[src]

impl<C0, C1, C2, C3, C4, C5> IntoField<FieldPath<(TString<(_0,)>,)>> for (C0, C1, C2, C3, C4, C5)[src]

impl<C0, C1, C2, C3, C4, C5> IntoField<FieldPath<(TString<(_1,)>,)>> for (C0, C1, C2, C3, C4, C5)[src]

impl<C0, C1, C2, C3, C4, C5> IntoField<FieldPath<(TString<(_2,)>,)>> for (C0, C1, C2, C3, C4, C5)[src]

impl<C0, C1, C2, C3, C4, C5> IntoField<FieldPath<(TString<(_3,)>,)>> for (C0, C1, C2, C3, C4, C5)[src]

impl<C0, C1, C2, C3, C4, C5> IntoField<FieldPath<(TString<(_4,)>,)>> for (C0, C1, C2, C3, C4, C5)[src]

impl<C0, C1, C2, C3, C4, C5> IntoField<FieldPath<(TString<(_5,)>,)>> for (C0, C1, C2, C3, C4, C5)[src]

impl<C0, C1, C2, C3, C4, C5, C6> IntoField<FieldPath<(TString<(_0,)>,)>> for (C0, C1, C2, C3, C4, C5, C6)[src]

impl<C0, C1, C2, C3, C4, C5, C6> IntoField<FieldPath<(TString<(_1,)>,)>> for (C0, C1, C2, C3, C4, C5, C6)[src]

impl<C0, C1, C2, C3, C4, C5, C6> IntoField<FieldPath<(TString<(_2,)>,)>> for (C0, C1, C2, C3, C4, C5, C6)[src]

impl<C0, C1, C2, C3, C4, C5, C6> IntoField<FieldPath<(TString<(_3,)>,)>> for (C0, C1, C2, C3, C4, C5, C6)[src]

impl<C0, C1, C2, C3, C4, C5, C6> IntoField<FieldPath<(TString<(_4,)>,)>> for (C0, C1, C2, C3, C4, C5, C6)[src]

impl<C0, C1, C2, C3, C4, C5, C6> IntoField<FieldPath<(TString<(_5,)>,)>> for (C0, C1, C2, C3, C4, C5, C6)[src]

impl<C0, C1, C2, C3, C4, C5, C6> IntoField<FieldPath<(TString<(_6,)>,)>> for (C0, C1, C2, C3, C4, C5, C6)[src]

impl<C0, C1, C2, C3, C4, C5, C6, C7> IntoField<FieldPath<(TString<(_0,)>,)>> for (C0, C1, C2, C3, C4, C5, C6, C7)[src]

impl<C0, C1, C2, C3, C4, C5, C6, C7> IntoField<FieldPath<(TString<(_1,)>,)>> for (C0, C1, C2, C3, C4, C5, C6, C7)[src]

impl<C0, C1, C2, C3, C4, C5, C6, C7> IntoField<FieldPath<(TString<(_2,)>,)>> for (C0, C1, C2, C3, C4, C5, C6, C7)[src]

impl<C0, C1, C2, C3, C4, C5, C6, C7> IntoField<FieldPath<(TString<(_3,)>,)>> for (C0, C1, C2, C3, C4, C5, C6, C7)[src]

impl<C0, C1, C2, C3, C4, C5, C6, C7> IntoField<FieldPath<(TString<(_4,)>,)>> for (C0, C1, C2, C3, C4, C5, C6, C7)[src]

impl<C0, C1, C2, C3, C4, C5, C6, C7> IntoField<FieldPath<(TString<(_5,)>,)>> for (C0, C1, C2, C3, C4, C5, C6, C7)[src]

impl<C0, C1, C2, C3, C4, C5, C6, C7> IntoField<FieldPath<(TString<(_6,)>,)>> for (C0, C1, C2, C3, C4, C5, C6, C7)[src]

impl<C0, C1, C2, C3, C4, C5, C6, C7> IntoField<FieldPath<(TString<(_7,)>,)>> for (C0, C1, C2, C3, C4, C5, C6, C7)[src]

impl<C0, C1, C2, C3, C4, C5, C6, C7, C8> IntoField<FieldPath<(TString<(_0,)>,)>> for (C0, C1, C2, C3, C4, C5, C6, C7, C8)[src]

impl<C0, C1, C2, C3, C4, C5, C6, C7, C8> IntoField<FieldPath<(TString<(_1,)>,)>> for (C0, C1, C2, C3, C4, C5, C6, C7, C8)[src]

impl<C0, C1, C2, C3, C4, C5, C6, C7, C8> IntoField<FieldPath<(TString<(_2,)>,)>> for (C0, C1, C2, C3, C4, C5, C6, C7, C8)[src]

impl<C0, C1, C2, C3, C4, C5, C6, C7, C8> IntoField<FieldPath<(TString<(_3,)>,)>> for (C0, C1, C2, C3, C4, C5, C6, C7, C8)[src]

impl<C0, C1, C2, C3, C4, C5, C6, C7, C8> IntoField<FieldPath<(TString<(_4,)>,)>> for (C0, C1, C2, C3, C4, C5, C6, C7, C8)[src]

impl<C0, C1, C2, C3, C4, C5, C6, C7, C8> IntoField<FieldPath<(TString<(_5,)>,)>> for (C0, C1, C2, C3, C4, C5, C6, C7, C8)[src]

impl<C0, C1, C2, C3, C4, C5, C6, C7, C8> IntoField<FieldPath<(TString<(_6,)>,)>> for (C0, C1, C2, C3, C4, C5, C6, C7, C8)[src]

impl<C0, C1, C2, C3, C4, C5, C6, C7, C8> IntoField<FieldPath<(TString<(_7,)>,)>> for (C0, C1, C2, C3, C4, C5, C6, C7, C8)[src]

impl<C0, C1, C2, C3, C4, C5, C6, C7, C8> IntoField<FieldPath<(TString<(_8,)>,)>> for (C0, C1, C2, C3, C4, C5, C6, C7, C8)[src]

impl<C0, C1, C2, C3, C4, C5, C6, C7, C8, C9> IntoField<FieldPath<(TString<(_0,)>,)>> for (C0, C1, C2, C3, C4, C5, C6, C7, C8, C9)[src]

impl<C0, C1, C2, C3, C4, C5, C6, C7, C8, C9> IntoField<FieldPath<(TString<(_1,)>,)>> for (C0, C1, C2, C3, C4, C5, C6, C7, C8, C9)[src]

impl<C0, C1, C2, C3, C4, C5, C6, C7, C8, C9> IntoField<FieldPath<(TString<(_2,)>,)>> for (C0, C1, C2, C3, C4, C5, C6, C7, C8, C9)[src]

impl<C0, C1, C2, C3, C4, C5, C6, C7, C8, C9> IntoField<FieldPath<(TString<(_3,)>,)>> for (C0, C1, C2, C3, C4, C5, C6, C7, C8, C9)[src]

impl<C0, C1, C2, C3, C4, C5, C6, C7, C8, C9> IntoField<FieldPath<(TString<(_4,)>,)>> for (C0, C1, C2, C3, C4, C5, C6, C7, C8, C9)[src]

impl<C0, C1, C2, C3, C4, C5, C6, C7, C8, C9> IntoField<FieldPath<(TString<(_5,)>,)>> for (C0, C1, C2, C3, C4, C5, C6, C7, C8, C9)[src]

impl<C0, C1, C2, C3, C4, C5, C6, C7, C8, C9> IntoField<FieldPath<(TString<(_6,)>,)>> for (C0, C1, C2, C3, C4, C5, C6, C7, C8, C9)[src]

impl<C0, C1, C2, C3, C4, C5, C6, C7, C8, C9> IntoField<FieldPath<(TString<(_7,)>,)>> for (C0, C1, C2, C3, C4, C5, C6, C7, C8, C9)[src]

impl<C0, C1, C2, C3, C4, C5, C6, C7, C8, C9> IntoField<FieldPath<(TString<(_8,)>,)>> for (C0, C1, C2, C3, C4, C5, C6, C7, C8, C9)[src]

impl<C0, C1, C2, C3, C4, C5, C6, C7, C8, C9> IntoField<FieldPath<(TString<(_9,)>,)>> for (C0, C1, C2, C3, C4, C5, C6, C7, C8, C9)[src]

impl<C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10> IntoField<FieldPath<(TString<(_0,)>,)>> for (C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10)[src]

impl<C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10> IntoField<FieldPath<(TString<(_1,)>,)>> for (C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10)[src]

impl<C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10> IntoField<FieldPath<(TString<(_2,)>,)>> for (C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10)[src]

impl<C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10> IntoField<FieldPath<(TString<(_3,)>,)>> for (C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10)[src]

impl<C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10> IntoField<FieldPath<(TString<(_4,)>,)>> for (C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10)[src]

impl<C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10> IntoField<FieldPath<(TString<(_5,)>,)>> for (C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10)[src]

impl<C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10> IntoField<FieldPath<(TString<(_6,)>,)>> for (C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10)[src]

impl<C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10> IntoField<FieldPath<(TString<(_7,)>,)>> for (C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10)[src]

impl<C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10> IntoField<FieldPath<(TString<(_8,)>,)>> for (C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10)[src]

impl<C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10> IntoField<FieldPath<(TString<(_9,)>,)>> for (C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10)[src]

impl<C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10> IntoField<FieldPath<(TString<(_1, _0)>,)>> for (C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10)[src]

impl<C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11> IntoField<FieldPath<(TString<(_0,)>,)>> for (C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11)[src]

impl<C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11> IntoField<FieldPath<(TString<(_1,)>,)>> for (C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11)[src]

impl<C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11> IntoField<FieldPath<(TString<(_2,)>,)>> for (C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11)[src]

impl<C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11> IntoField<FieldPath<(TString<(_3,)>,)>> for (C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11)[src]

impl<C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11> IntoField<FieldPath<(TString<(_4,)>,)>> for (C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11)[src]

impl<C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11> IntoField<FieldPath<(TString<(_5,)>,)>> for (C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11)[src]

impl<C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11> IntoField<FieldPath<(TString<(_6,)>,)>> for (C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11)[src]

impl<C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11> IntoField<FieldPath<(TString<(_7,)>,)>> for (C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11)[src]

impl<C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11> IntoField<FieldPath<(TString<(_8,)>,)>> for (C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11)[src]

impl<C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11> IntoField<FieldPath<(TString<(_9,)>,)>> for (C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11)[src]

impl<C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11> IntoField<FieldPath<(TString<(_1, _0)>,)>> for (C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11)[src]

impl<C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11> IntoField<FieldPath<(TString<(_1, _1)>,)>> for (C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11)[src]

impl<T> IntoField<FieldPath<(TString<(_s, _t, _a, _r, _t)>,)>> for Range<T>[src]

impl<T> IntoField<FieldPath<(TString<(_e, _n, _d)>,)>> for Range<T>[src]

impl<T> IntoField<FieldPath<(TString<(_s, _t, _a, _r, _t)>,)>> for RangeFrom<T>[src]

impl<T> IntoField<FieldPath<(TString<(_e, _n, _d)>,)>> for RangeTo<T>[src]

impl<T> IntoField<FieldPath<(TString<(_e, _n, _d)>,)>> for RangeToInclusive<T>[src]

impl<T> IntoField<FieldPath<(TString<(_s, _t, _a, _r, _t)>,)>> for RangeInclusive<T>[src]

impl<T> IntoField<FieldPath<(TString<(_e, _n, _d)>,)>> for RangeInclusive<T>[src]

impl<T, __FieldName> IntoField<__FieldName> for ManuallyDrop<T> where
    T: IntoField<__FieldName>, 
[src]

Loading content...

Implementors

Loading content...