#[repr(transparent)]pub struct FieldCloner<T>(pub T);
Expand description
Wrapper that emulates by-value access to fields by cloning them.
This allows using types that only provide shared access to fields
(implementing GetField
/GetVariantField
)
to be passed to functions expecting by-value access to them
(requiring IntoField
/IntoVariantField
),
by cloning those fields.
§Struct Example
use structural::{FieldCloner, Structural, StructuralExt, fp, structural_alias};
let expected = ("what".to_string(), vec![0,1,2]);
let this = TheStruct{foo: "what".to_string(), bar: vec![0,1,2]};
// This doesn't compile,because `TheStruct` only provides shared access to the fields,
// implementing `GetField` to access both the `foo` and `bar` fields.
//
// assert_eq!( into_foo_bar(this), expected.clone() );
assert_eq!( into_foo_bar(FieldCloner(this.clone())), expected.clone() );
assert_eq!( into_foo_bar(FieldCloner(&this)), expected.clone() );
assert_eq!( into_foo_bar(FieldCloner(&&&&&this)), expected.clone() );
fn into_foo_bar<P, T>(this: P)-> (String, Vec<T>)
where
P: TypeMove<String, Vec<T>>,
{
this.into_fields(fp!(foo, bar))
}
#[derive(Structural,Clone)]
// Makes this struct only implement `GetField` for the fields,
// providing shared access to them.
#[struc(access="ref")]
struct TheStruct<T, U>{
pub foo: T,
pub bar: U,
}
structural::structural_alias!{
// The same fields as `TheStruct`, with shared and by-value access to the fields.
//
// This trait isn't implemented by `TheStruct` because it only
// provides shared access to the fields.
trait TypeMove<T, U>{
move foo: T,
move bar: U,
}
}
§Enum Example
use structural::{FieldCloner, Structural, StructuralExt, fp, structural_alias};
{
let expected = Some((vec!["foo","bar"], [0, 1, 2]));
let this = TheEnum::Both(vec!["foo","bar"], [0, 1, 2]);
// This doesn't compile,because `TheEnum` only provides shared access to the fields,
// implementing `GetField` to access both the `foo` and `bar` fields.
//
// assert_eq!( into_both(Box::new(this)), expected.clone() );
assert_eq!( into_both(Box::new(FieldCloner(this.clone()))), expected.clone() );
assert_eq!( into_both(Box::new(FieldCloner(&this))), expected.clone() );
assert_eq!( into_both(Box::new(FieldCloner(&&&&&this))), expected.clone() );
}
{
let this = TheEnum::Left{left: vec!["foo","bar"]};
assert_eq!( into_both(Box::new(FieldCloner(this.clone()))), None );
assert_eq!( into_both(Box::new(FieldCloner(&this))), None );
assert_eq!( into_both(Box::new(FieldCloner(&&&&&this))), None );
}
fn into_both<'a,T>(
this: Box<dyn TypeMove<Vec<T>, [u32;3]> + 'a>
)-> Option<(Vec<T>, [u32;3])> {
this.into_fields(fp!(::Both=>0,1))
}
#[derive(Structural, Clone)]
// Makes this enum only implement `GetVariantField` for the fields,
// providing shared access to them.
#[struc(access="ref")]
pub enum TheEnum<L, R> {
Both(L, R),
Left{left: L},
Right{right: R},
}
structural::structural_alias!{
// The same fields as `TheEnum`, with shared and by-value access to the fields.
//
// This trait isn't implemented by `TheEnum` because it only
// provides shared access to the fields.
trait TypeMove<L, R>{
move Both(L, R),
move Left{left: L},
move Right{right: R},
}
}
Tuple Fields§
§0: T
Implementations§
Source§impl<T> FieldCloner<T>
impl<T> FieldCloner<T>
Sourcepub fn as_ref(&self) -> FieldCloner<&T>
pub fn as_ref(&self) -> FieldCloner<&T>
Turns a &FieldCloner<T>
into a FieldCloner<&T>
.
§Struct Example
use structural::{FieldCloner, StructuralExt, fp};
use structural::for_examples::{FooBarRef, FooBarMove_SI};
let this = FieldCloner(FooBarRef{foo: 100, bar: "baz"});
assert_eq!( into_foo(this.as_ref()), 100 );
fn into_foo<T, U>(this: impl FooBarMove_SI<T, U>)-> T {
this.into_field(fp!(foo))
}
§Enum Example
use structural::{FieldCloner, StructuralExt, fp};
use structural::for_examples::{EnumRef, EnumMove_SI};
let this = FieldCloner(EnumRef::Left{left: 10});
assert_eq!( into_left(this.as_ref()), Some(10) );
fn into_left(this: impl EnumMove_SI<u32, bool>)-> Option<u32> {
this.into_field(fp!(::Left.left))
}
Sourcepub fn as_mut(&mut self) -> FieldCloner<&mut T>
pub fn as_mut(&mut self) -> FieldCloner<&mut T>
Turns a &mut FieldCloner<T>
into a FieldCloner<&mut T>
.
§Struct Example
use structural::{FieldCloner, StructuralExt, fp};
use structural::for_examples::{FooBarRef, FooBarMove_SI};
let this = FieldCloner(FooBarRef{foo: 100, bar: "baz"});
assert_eq!( into_bar(this.as_ref()), "baz" );
fn into_bar<T, U>(this: impl FooBarMove_SI<T, U>)-> U {
this.into_field(fp!(bar))
}
§Enum Example
use structural::{FieldCloner, StructuralExt, fp};
use structural::for_examples::{EnumRef, EnumMove_SI};
let mut this = FieldCloner(EnumRef::Right{right: false});
assert_eq!( into_right(this.as_mut()), Some(false) );
fn into_right(this: impl EnumMove_SI<u32, bool>)-> Option<bool> {
this.into_field(fp!(::Right.right))
}
Sourcepub fn map<F, U>(self, f: F) -> FieldCloner<U>where
F: FnOnce(T) -> U,
pub fn map<F, U>(self, f: F) -> FieldCloner<U>where
F: FnOnce(T) -> U,
Transforms the wrapped value with the func
function.
Sourcepub fn then<F, U>(self, f: F) -> FieldCloner<U>where
F: FnOnce(Self) -> U,
pub fn then<F, U>(self, f: F) -> FieldCloner<U>where
F: FnOnce(Self) -> U,
Calls func
with self
,rewrapping its return value in a FieldCloner<U>
Source§impl<T: Clone> FieldCloner<&T>
impl<T: Clone> FieldCloner<&T>
Sourcepub fn cloned(self) -> FieldCloner<T>
pub fn cloned(self) -> FieldCloner<T>
Maps the wrapped reference into a clone.
Source§impl<T: Clone> FieldCloner<&mut T>
impl<T: Clone> FieldCloner<&mut T>
Sourcepub fn cloned(self) -> FieldCloner<T>
pub fn cloned(self) -> FieldCloner<T>
Maps the wrapped mutable reference into a clone.
Trait Implementations§
Source§impl<T: Clone> Clone for FieldCloner<T>
impl<T: Clone> Clone for FieldCloner<T>
Source§fn clone(&self) -> FieldCloner<T>
fn clone(&self) -> FieldCloner<T>
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl<T> ConstDefault for FieldCloner<T>where
T: ConstDefault,
impl<T> ConstDefault for FieldCloner<T>where
T: ConstDefault,
Source§impl<T: Debug> Debug for FieldCloner<T>
impl<T: Debug> Debug for FieldCloner<T>
Source§impl<T: Default> Default for FieldCloner<T>
impl<T: Default> Default for FieldCloner<T>
Source§fn default() -> FieldCloner<T>
fn default() -> FieldCloner<T>
Returns the “default value” for a type. Read more
Source§impl<T> DropFields for FieldCloner<T>
impl<T> DropFields for FieldCloner<T>
Source§unsafe fn drop_fields(&mut self, _: MovedOutFields)
unsafe fn drop_fields(&mut self, _: MovedOutFields)
Drops all the fields that were not moved out. Read more
Source§impl<T, NP, __Ty> FieldType<NP> for FieldCloner<T>where
T: FieldType<NP, Ty = __Ty>,
impl<T, NP, __Ty> FieldType<NP> for FieldCloner<T>where
T: FieldType<NP, Ty = __Ty>,
Source§impl<T, __From> FromStructural<__From> for FieldCloner<T>where
T: FromStructural<__From>,
impl<T, __From> FromStructural<__From> for FieldCloner<T>where
T: FromStructural<__From>,
Source§fn from_structural(from: __From) -> Self
fn from_structural(from: __From) -> Self
Performs the conversion
Source§impl<T, __F, __Ty> GetField<__F> for FieldCloner<T>where
T: GetField<__F, Ty = __Ty>,
impl<T, __F, __Ty> GetField<__F> for FieldCloner<T>where
T: GetField<__F, Ty = __Ty>,
Source§fn get_field_(&self, fname: __F) -> &__Ty
fn get_field_(&self, fname: __F) -> &__Ty
Accesses the
FieldName
field by reference.Source§impl<T, __F, __Ty> GetFieldMut<__F> for FieldCloner<T>
impl<T, __F, __Ty> GetFieldMut<__F> for FieldCloner<T>
Source§fn get_field_mut_(&mut self, fname: __F) -> &mut __Ty
fn get_field_mut_(&mut self, fname: __F) -> &mut __Ty
Accesses the
FieldName
field by mutable reference.Source§unsafe fn get_field_raw_mut(this: *mut (), fname: __F) -> *mut __Tywhere
Self: Sized,
unsafe fn get_field_raw_mut(this: *mut (), fname: __F) -> *mut __Tywhere
Self: Sized,
Gets a mutable pointer for the field. Read more
Source§fn get_field_raw_mut_fn(&self) -> GetFieldRawMutFn<__F, __Ty>
fn get_field_raw_mut_fn(&self) -> GetFieldRawMutFn<__F, __Ty>
Gets the
get_field_raw_mut
associated function as a function pointer.Source§impl<T, __V, __F, __Ty> GetVariantField<TStr<__V>, __F> for FieldCloner<T>where
T: GetVariantField<TStr<__V>, __F, Ty = __Ty>,
impl<T, __V, __F, __Ty> GetVariantField<TStr<__V>, __F> for FieldCloner<T>where
T: GetVariantField<TStr<__V>, __F, Ty = __Ty>,
Source§fn get_vfield_(
&self,
vname: TStr<__V>,
fname: __F,
) -> Option<&GetVariantFieldType<T, TStr<__V>, __F>>
fn get_vfield_( &self, vname: TStr<__V>, fname: __F, ) -> Option<&GetVariantFieldType<T, TStr<__V>, __F>>
Accesses the
F
field in the V
variant by reference.Source§unsafe fn get_vfield_unchecked(&self, variant: V, field: F) -> &Self::Ty
unsafe fn get_vfield_unchecked(&self, variant: V, field: F) -> &Self::Ty
Accesses the
F
field in the V
variant by reference,
without checking that the enum is currently the V
variant. Read moreSource§impl<T, __V, __F, __Ty> GetVariantFieldMut<TStr<__V>, __F> for FieldCloner<T>
impl<T, __V, __F, __Ty> GetVariantFieldMut<TStr<__V>, __F> for FieldCloner<T>
Source§fn get_vfield_mut_(&mut self, vname: TStr<__V>, fname: __F) -> Option<&mut __Ty>
fn get_vfield_mut_(&mut self, vname: TStr<__V>, fname: __F) -> Option<&mut __Ty>
Accesses the
F
field in the V
variant by mutable reference.Source§unsafe fn get_vfield_raw_mut_(
this: *mut (),
vname: TStr<__V>,
fname: __F,
) -> Option<NonNull<__Ty>>where
Self: Sized,
unsafe fn get_vfield_raw_mut_(
this: *mut (),
vname: TStr<__V>,
fname: __F,
) -> Option<NonNull<__Ty>>where
Self: Sized,
Source§fn get_vfield_raw_mut_unchecked_fn(&self) -> GetFieldRawMutFn<__F, __Ty>
fn get_vfield_raw_mut_unchecked_fn(&self) -> GetFieldRawMutFn<__F, __Ty>
Gets a function pointer to the
get_vfield_raw_mut_unchecked
method. Read moreSource§fn get_vfield_raw_mut_fn(&self) -> GetVFieldRawMutFn<TStr<__V>, __F, __Ty>
fn get_vfield_raw_mut_fn(&self) -> GetVFieldRawMutFn<TStr<__V>, __F, __Ty>
Gets a function pointer to the
get_vfield_raw_mut_
method. Read moreSource§unsafe fn get_vfield_mut_unchecked(
&mut self,
variant: V,
field: F,
) -> &mut Self::Ty
unsafe fn get_vfield_mut_unchecked( &mut self, variant: V, field: F, ) -> &mut Self::Ty
Accesses the
F
field in the V
variant by mutable reference,
without checking that the enum is currently the V
variant. Read moreSource§unsafe fn get_vfield_raw_mut_unchecked(ptr: *mut (), field: F) -> *mut Self::Tywhere
Self: Sized,
V: ConstDefault,
unsafe fn get_vfield_raw_mut_unchecked(ptr: *mut (), field: F) -> *mut Self::Tywhere
Self: Sized,
V: ConstDefault,
Accesses the
F
field in the V
variant by raw pointer,
without checking that the enum is currently the V
variant. Read moreSource§impl<T: Hash> Hash for FieldCloner<T>
impl<T: Hash> Hash for FieldCloner<T>
Source§impl<T, P> IntoField<P> for FieldCloner<T>
impl<T, P> IntoField<P> for FieldCloner<T>
Source§fn into_field_(self, path: P) -> Self::Ty
fn into_field_(self, path: P) -> Self::Ty
Converts this into the field by value.
Source§unsafe fn move_out_field_(
&mut self,
path: P,
_: &mut MovedOutFields,
) -> Self::Ty
unsafe fn move_out_field_( &mut self, path: P, _: &mut MovedOutFields, ) -> Self::Ty
Moves out the field from self. Read more
Source§impl<T, V, F> IntoVariantField<TStr<V>, F> for FieldCloner<T>
impl<T, V, F> IntoVariantField<TStr<V>, F> for FieldCloner<T>
Source§fn into_vfield_(self, variant_name: TStr<V>, field_name: F) -> Option<Self::Ty>
fn into_vfield_(self, variant_name: TStr<V>, field_name: F) -> Option<Self::Ty>
Converts this into the
F
field in the V
variant by value.Source§unsafe fn move_out_vfield_(
&mut self,
variant_name: TStr<V>,
field_name: F,
_: &mut MovedOutFields,
) -> Option<Self::Ty>
unsafe fn move_out_vfield_( &mut self, variant_name: TStr<V>, field_name: F, _: &mut MovedOutFields, ) -> Option<Self::Ty>
Source§unsafe fn into_vfield_unchecked_(
self,
variant_name: V,
field_name: F,
) -> Self::Tywhere
Self: Sized,
unsafe fn into_vfield_unchecked_(
self,
variant_name: V,
field_name: F,
) -> Self::Tywhere
Self: Sized,
Source§unsafe fn move_out_vfield_unchecked_(
&mut self,
variant_name: V,
field_name: F,
moved_fields: &mut MovedOutFields,
) -> Self::Ty
unsafe fn move_out_vfield_unchecked_( &mut self, variant_name: V, field_name: F, moved_fields: &mut MovedOutFields, ) -> Self::Ty
Converts this into the
F
field in the V
variant by value,
without checking that the enum is currently the V
variant. Read moreSource§impl<T, __V> IsVariant<TStr<__V>> for FieldCloner<T>
impl<T, __V> IsVariant<TStr<__V>> for FieldCloner<T>
Source§fn is_variant_(&self, name: TStr<__V>) -> bool
fn is_variant_(&self, name: TStr<__V>) -> bool
Checks whether this enum is the variant that
V
stands for.Source§impl<T: Ord> Ord for FieldCloner<T>
impl<T: Ord> Ord for FieldCloner<T>
Source§fn cmp(&self, other: &FieldCloner<T>) -> Ordering
fn cmp(&self, other: &FieldCloner<T>) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl<T: PartialEq> PartialEq for FieldCloner<T>
impl<T: PartialEq> PartialEq for FieldCloner<T>
Source§impl<T: PartialOrd> PartialOrd for FieldCloner<T>
impl<T: PartialOrd> PartialOrd for FieldCloner<T>
Source§impl<T, __From, __Err> TryFromStructural<__From> for FieldCloner<T>where
T: TryFromStructural<__From, Error = __Err>,
impl<T, __From, __Err> TryFromStructural<__From> for FieldCloner<T>where
T: TryFromStructural<__From, Error = __Err>,
Source§type Error = __Err
type Error = __Err
The error parameter of
TryFromError
,
returned from try_into_structural
on conversion error.Source§fn try_from_structural(
from: __From,
) -> Result<Self, TryFromError<__From, __Err>>
fn try_from_structural( from: __From, ) -> Result<Self, TryFromError<__From, __Err>>
Performs the conversion
Source§impl<T> VariantCount for FieldCloner<T>where
T: VariantCount,
impl<T> VariantCount for FieldCloner<T>where
T: VariantCount,
impl<T: Copy> Copy for FieldCloner<T>
impl<T: Eq> Eq for FieldCloner<T>
impl<T> Structural for FieldCloner<T>where
T: Structural,
impl<T> StructuralPartialEq for FieldCloner<T>
Auto Trait Implementations§
impl<T> Freeze for FieldCloner<T>where
T: Freeze,
impl<T> RefUnwindSafe for FieldCloner<T>where
T: RefUnwindSafe,
impl<T> Send for FieldCloner<T>where
T: Send,
impl<T> Sync for FieldCloner<T>where
T: Sync,
impl<T> Unpin for FieldCloner<T>where
T: Unpin,
impl<T> UnwindSafe for FieldCloner<T>where
T: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<This> EnumExt for Thiswhere
This: ?Sized,
impl<This> EnumExt for Thiswhere
This: ?Sized,
Source§fn as_variant<V>(
&self,
vari: TStr<V>,
) -> Result<&VariantProxy<Self, TStr<V>>, &Self>
fn as_variant<V>( &self, vari: TStr<V>, ) -> Result<&VariantProxy<Self, TStr<V>>, &Self>
Fallibly converts a reference to an enum into
a reference of a VariantProxy of some variant. Read more
Source§fn as_mut_variant<V>(
&mut self,
vari: TStr<V>,
) -> Result<&mut VariantProxy<Self, TStr<V>>, &mut Self>
fn as_mut_variant<V>( &mut self, vari: TStr<V>, ) -> Result<&mut VariantProxy<Self, TStr<V>>, &mut Self>
Fallibly converts a mutable reference to an enum into
a mutable reference of a VariantProxy of some variant. Read more
Source§impl<This, T> IntoStructural<T> for Thiswhere
T: FromStructural<This>,
impl<This, T> IntoStructural<T> for Thiswhere
T: FromStructural<This>,
Source§fn into_structural(self) -> T
fn into_structural(self) -> T
Performs the conversion
Source§impl<T> SelfOps for Twhere
T: ?Sized,
impl<T> SelfOps for Twhere
T: ?Sized,
Source§const T: PhantomData<fn() -> Self> = PhantomData
const T: PhantomData<fn() -> Self> = PhantomData
Represents Self by using a VariantPhantom,
using the syntax
Type::T
to pass it in methods with _:VariantPhantom<T>
parameters. Read moreSource§const T_D: PhantomData<Self> = PhantomData
const T_D: PhantomData<Self> = PhantomData
Represents Self by using a VariantDropPhantom,for specialized cases. Read more
Source§fn assert_ty(self, _other: PhantomData<fn() -> Self>) -> Selfwhere
Self: Sized,
fn assert_ty(self, _other: PhantomData<fn() -> Self>) -> Selfwhere
Self: Sized,
Asserts that
other
is the same type as self
.Source§fn assert_ty_ref(&self, _other: PhantomData<fn() -> Self>) -> &Selfwhere
Self: Sized,
fn assert_ty_ref(&self, _other: PhantomData<fn() -> Self>) -> &Selfwhere
Self: Sized,
Asserts that
other
is the same type as self
.Source§fn assert_ty_mut(&mut self, _other: PhantomData<fn() -> Self>) -> &mut Selfwhere
Self: Sized,
fn assert_ty_mut(&mut self, _other: PhantomData<fn() -> Self>) -> &mut Selfwhere
Self: Sized,
Asserts that
other
is the same type as self
.Source§fn ty_(&self) -> PhantomData<fn() -> Self>
fn ty_(&self) -> PhantomData<fn() -> Self>
Equivalent to SelfOps::T,as a method. Read more
Source§fn ty_inv(&self) -> PhantomData<fn(Self) -> Self>
fn ty_inv(&self) -> PhantomData<fn(Self) -> Self>
Equivalent to Self::ty_ with an invariant type.
Source§fn ty_inv_ref(&self) -> PhantomData<Cell<&Self>>
fn ty_inv_ref(&self) -> PhantomData<Cell<&Self>>
Equivalent to Self::ty_ with an invariant lifetime.
Source§fn eq_id(&self, other: &Self) -> bool
fn eq_id(&self, other: &Self) -> bool
Identity comparison to another value of the same type. Read more
Source§fn piped<F, U>(self, f: F) -> U
fn piped<F, U>(self, f: F) -> U
Emulates the pipeline operator,allowing method syntax in more places. Read more
Source§fn piped_ref<'a, F, U>(&'a self, f: F) -> Uwhere
F: FnOnce(&'a Self) -> U,
fn piped_ref<'a, F, U>(&'a self, f: F) -> Uwhere
F: FnOnce(&'a Self) -> U,
The same as
piped
except that the function takes &Self
Useful for functions that take &Self
instead of Self
. Read moreSource§fn piped_mut<'a, F, U>(&'a mut self, f: F) -> Uwhere
F: FnOnce(&'a mut Self) -> U,
fn piped_mut<'a, F, U>(&'a mut self, f: F) -> Uwhere
F: FnOnce(&'a mut Self) -> U,
The same as
piped
except that the function takes &mut Self
.
Useful for functions that take &mut Self
instead of Self
.Source§fn mutated<F>(self, f: F) -> Self
fn mutated<F>(self, f: F) -> Self
Mutates self using a closure taking self by mutable reference,
passing it along the method chain. Read more
Source§fn observe<F>(self, f: F) -> Self
fn observe<F>(self, f: F) -> Self
Observes the value of self passing it along unmodified.
Useful in a long method chain. Read more
Source§fn into_<T>(self, _: PhantomData<fn() -> T>) -> Twhere
Self: Into<T>,
fn into_<T>(self, _: PhantomData<fn() -> T>) -> Twhere
Self: Into<T>,
Performs a conversion using Into. Read more
Source§fn as_ref_<T>(&self) -> &T
fn as_ref_<T>(&self) -> &T
Performs a reference to reference conversion using AsRef,
using the turbofish
.as_ref_::<_>()
syntax. Read moreSource§impl<T> StructuralExt for Twhere
T: ?Sized,
impl<T> StructuralExt for Twhere
T: ?Sized,
Source§fn field_<'a, P>(
&'a self,
path: P,
) -> NormalizeFieldsOut<Result<&'a P::Ty, P::Err>>
fn field_<'a, P>( &'a self, path: P, ) -> NormalizeFieldsOut<Result<&'a P::Ty, P::Err>>
Gets a reference to a field,determined by
path
. Read moreSource§fn fields<'a, P>(&'a self, path: P) -> RevGetMultiFieldOut<'a, P, Self>where
P: RevGetMultiField<'a, Self>,
fn fields<'a, P>(&'a self, path: P) -> RevGetMultiFieldOut<'a, P, Self>where
P: RevGetMultiField<'a, Self>,
Gets references to multiple fields,determined by
path
. Read moreSource§fn cloned_fields<'a, P>(
&'a self,
path: P,
) -> ClonedOut<RevGetMultiFieldOut<'a, P, Self>>
fn cloned_fields<'a, P>( &'a self, path: P, ) -> ClonedOut<RevGetMultiFieldOut<'a, P, Self>>
Gets clones of multiple fields,determined by
path
. Read moreSource§fn field_mut<'a, P>(
&'a mut self,
path: P,
) -> NormalizeFieldsOut<Result<&'a mut P::Ty, P::Err>>
fn field_mut<'a, P>( &'a mut self, path: P, ) -> NormalizeFieldsOut<Result<&'a mut P::Ty, P::Err>>
Gets a mutable reference to a field,determined by
path
. Read moreSource§fn fields_mut<'a, P>(
&'a mut self,
path: P,
) -> RevGetMultiFieldMutOut<'a, P, Self>where
P: RevGetMultiFieldMut<'a, Self>,
fn fields_mut<'a, P>(
&'a mut self,
path: P,
) -> RevGetMultiFieldMutOut<'a, P, Self>where
P: RevGetMultiFieldMut<'a, Self>,
Gets mutable references to multiple fields,determined by
path
. Read moreSource§fn into_field<P>(self, path: P) -> NormalizeFieldsOut<Result<P::Ty, P::Err>>
fn into_field<P>(self, path: P) -> NormalizeFieldsOut<Result<P::Ty, P::Err>>
Converts ´self´ into a field,determined by
path
. Read moreSource§fn into_fields<P>(self, path: P) -> RevIntoMultiFieldOut<P, Self>where
P: RevIntoMultiField<Self>,
Self: Sized,
fn into_fields<P>(self, path: P) -> RevIntoMultiFieldOut<P, Self>where
P: RevIntoMultiField<Self>,
Self: Sized,
Converts
self
into multiple fields by value. Read moreSource§fn is_variant<P>(&self, _path: P) -> bool
fn is_variant<P>(&self, _path: P) -> bool
Checks whether an enum is a particular variant. Read more
Source§fn into_struc<U>(self) -> Uwhere
Self: IntoStructural<U>,
fn into_struc<U>(self) -> Uwhere
Self: IntoStructural<U>,
Converts this into another structural type using
IntoStructural
. Read moreSource§fn try_into_struc<U>(self) -> Result<U, TryFromError<Self, Self::Error>>where
Self: TryIntoStructural<U>,
fn try_into_struc<U>(self) -> Result<U, TryFromError<Self, Self::Error>>where
Self: TryIntoStructural<U>,
Performs a fallible conversion into another structural type using
TryIntoStructural
. Read moreSource§impl<This, T> TryIntoStructural<T> for Thiswhere
T: TryFromStructural<This>,
impl<This, T> TryIntoStructural<T> for Thiswhere
T: TryFromStructural<This>,
Source§type Error = <T as TryFromStructural<This>>::Error
type Error = <T as TryFromStructural<This>>::Error
The error parameter of
TryFromError
,
returned from try_into_structural
on conversion error.Source§fn try_into_structural(
self,
) -> Result<T, TryFromError<This, <This as TryIntoStructural<T>>::Error>>
fn try_into_structural( self, ) -> Result<T, TryFromError<This, <This as TryIntoStructural<T>>::Error>>
Performs the conversion
Source§impl<T> TypeIdentity for Twhere
T: ?Sized,
impl<T> TypeIdentity for Twhere
T: ?Sized,
Source§fn into_type_val(self) -> Self::Type
fn into_type_val(self) -> Self::Type
Converts a value back to the original type.
Source§fn into_type_ref(&self) -> &Self::Type
fn into_type_ref(&self) -> &Self::Type
Converts a reference back to the original type.
Source§fn into_type_mut(&mut self) -> &mut Self::Type
fn into_type_mut(&mut self) -> &mut Self::Type
Converts a mutable reference back to the original type.
Source§fn into_type_box(self: Box<Self>) -> Box<Self::Type>
fn into_type_box(self: Box<Self>) -> Box<Self::Type>
Converts a box back to the original type.
Source§fn into_type_arc(this: Arc<Self>) -> Arc<Self::Type>
fn into_type_arc(this: Arc<Self>) -> Arc<Self::Type>
Converts an Arc back to the original type.
Source§fn from_type_val(this: Self::Type) -> Self
fn from_type_val(this: Self::Type) -> Self
Converts a value back to the original type.
Source§fn from_type_ref(this: &Self::Type) -> &Self
fn from_type_ref(this: &Self::Type) -> &Self
Converts a reference back to the original type.
Source§fn from_type_mut(this: &mut Self::Type) -> &mut Self
fn from_type_mut(this: &mut Self::Type) -> &mut Self
Converts a mutable reference back to the original type.
Source§fn from_type_box(this: Box<Self::Type>) -> Box<Self>
fn from_type_box(this: Box<Self::Type>) -> Box<Self>
Converts a box back to the original type.