[][src]Struct structural::NestedFieldPathSet

pub struct NestedFieldPathSet<F, S, U> { /* fields omitted */ }

Allows accessing multiple fields inside of some nested field.

This is most useful for accessing multiple fields inside of a (nested) enum.

This is the type that fp!(a.b => b, c, d) and fp!(::Foo => bar, baz, qux) construct.

Uniqueness

If the U type parameter is a:

  • UniquePaths: all the field paths are unique, and this can be passed to StructuralExt::fields_mut and StructuralExt::into_fields.

  • AliasedPaths: there might be repeated field paths. This cannot be passed to StructuralExt::fields_mut, because it might borrow the same field mutably twice. This can also not be passed to StructuralExt::into_fields, because a field cannot generally be moved out twice.

Construction

NestedFieldPathSet can be constructed in these ways:

  • Using the fp macro.
    Example: fp!(::Foo=>a,b), this gets the a,and b fields from inside the Foo variant.
    Example: fp!(a.b=>uh,what), this gets the uh,and what fields from inside the a.b field.

  • Constructing it from a NestedFieldPath and a FieldPathSet.
    Example: NestedFieldPathSet::new( fp!(a.b.c), fp!(foo,bar,baz) ), this gets the foo,bar,and baz fields from inside the a.b.c field.
    Example: NestedFieldPathSet::new( fp!(::Foo), fp!(a,b) ), this gets the a,and b fields from inside the Foo variant.

  • Using the NEW associated constant, if F and S implements core_extensions::ConstDefault (reexported in structural::reexports::ConstDefault) Example: <FP!(::Foo=>a,b,c)>::NEW

Drop Types

To make all the inherent methods in this type const fn this type wraps the NestedFieldPath<F> inside a ManuallyDrop, which means that F won't be dropped inside. If that is a problem don't construct a NestedFieldPathSet with an F that owns some resource.

Examples

You can look for examples of using this in the multi-field StructuralExt methods, like fields,fields_mut,and into_fields (look for the enum examples).

Implementations

impl<F, S> NestedFieldPathSet<F, S, AliasedPaths> where
    F: ConstDefault,
    S: ConstDefault
[src]

pub const NEW: Self[src]

Constructs a NestedFieldPathSet.

impl<F, S, U> NestedFieldPathSet<F, S, U> where
    F: ConstDefault,
    S: ConstDefault
[src]

pub const NEW_ALIASED: NestedFieldPathSet<F, S, AliasedPaths>[src]

This can be used to construct a NestedFieldPathSet<T, UniquePaths> from a type alias, by doing unsafe{ FOO::NEW_ALIASED.upgrade_unchecked() } (read the docs for upgrade_unchecked first).

impl<F, S, U> NestedFieldPathSet<F, S, U>[src]

pub const fn new(nested: F, set: FieldPathSet<S, U>) -> Self[src]

Constructs a NestedFieldPathSet from an F and a FieldPathSet

pub const fn into_inner(self) -> (F, FieldPathSet<S, U>)[src]

Unwraps a NestedFieldPathSet into a NestedFieldPath and a FieldPathSet

pub const fn into_nested(self) -> F[src]

Unwraps a NestedFieldPathSet into the NestedFieldPath for the nested field.

pub const fn into_set(self) -> FieldPathSet<S, U>[src]

Unwraps a NestedFieldPathSet into the FieldPathSet used to access the multiple fields inside a nested field.

impl<F, S> NestedFieldPathSet<F, S, UniquePaths>[src]

pub const fn downgrade(self) -> NestedFieldPathSet<F, S, AliasedPaths>[src]

Converts a NestedFieldPathSet<F, S, UniquePaths> to a NestedFieldPathSet<F, S, AliasedPaths>

impl<F, S> NestedFieldPathSet<F, S, AliasedPaths>[src]

pub const unsafe fn upgrade_unchecked(
    self
) -> NestedFieldPathSet<F, S, UniquePaths>
[src]

Converts a NestedFieldPathSet<F, S, AliasedPaths> to a NestedFieldPathSet<F, S, UniquePaths>

Safety

You must ensure that all the field paths in in the S type parameter are unique, there must be no field path that is a prefix of any other field path.

pub const unsafe fn set_uniqueness<U>(self) -> NestedFieldPathSet<F, S, U>[src]

Converts a NestedFieldPathSet<F, S, AliasedPaths> to a NestedFieldPathSet<F, S, U>

Safety

If U == UniquePaths, you must ensure that all the field paths in the S type parameter are unique, there must be no field path that is a prefix of any other field path.

Trait Implementations

impl<F: Clone, S: Clone, U: Clone> Clone for NestedFieldPathSet<F, S, U>[src]

impl<F, S> ConstDefault for NestedFieldPathSet<F, S, AliasedPaths> where
    F: ConstDefault,
    S: ConstDefault
[src]

impl<F: Copy, S: Copy, U: Copy> Copy for NestedFieldPathSet<F, S, U>[src]

impl<F: Debug, S: Debug, U: Debug> Debug for NestedFieldPathSet<F, S, U>[src]

impl<F, S> Default for NestedFieldPathSet<F, S, AliasedPaths> where
    F: Default,
    S: Default
[src]

impl<F, S, U> IntoAliasing for NestedFieldPathSet<F, S, U>[src]

type Output = NestedFieldPathSet<F, S, AliasedPaths>

The return value of this trait.

impl<F, S, U> IsMultiFieldPath for NestedFieldPathSet<F, S, U>[src]

type PathUniqueness = U

Whether the paths in the set can contain duplicate paths. Read more

impl<F, S, U> IsSingleFieldPath for NestedFieldPathSet<F, (S,), U>[src]

impl<This, A, B, U> RevFieldErr<This> for NestedFieldPathSet<A, (B,), U> where
    This: ?Sized,
    A: RevFieldErr<This>,
    B: RevFieldErr<A::Ty>,
    (A::Err, B::Err): CombinedErrs
[src]

type Err = CombinedErrsOut<(A::Err, B::Err)>

The error returned by rev_* methods. Read more

impl<This, A, B, U> RevFieldType<This> for NestedFieldPathSet<A, (B,), U> where
    This: ?Sized,
    A: RevFieldType<This>,
    B: RevFieldType<A::Ty>, 
[src]

type Ty = B::Ty

The type of the field.

impl<'a, This: ?Sized, A, B, U> RevGetFieldImpl<'a, This> for NestedFieldPathSet<A, (B,), U> where
    This: 'a,
    A: RevGetFieldImpl<'a, This>,
    B: RevGetFieldImpl<'a, A::Ty>,
    A::Ty: 'a,
    Self: RevFieldErr<This, Ty = B::Ty>,
    A::Err: IntoFieldErr<Self::Err>,
    B::Err: IntoFieldErr<Self::Err>, 
[src]

impl<'a, This: ?Sized, A, B, U> RevGetFieldMutImpl<'a, This> for NestedFieldPathSet<A, (B,), U> where
    This: 'a,
    A: RevGetFieldMutImpl<'a, This>,
    B: RevGetFieldMutImpl<'a, A::Ty>,
    A::Ty: 'a,
    Self: RevFieldErr<This, Ty = B::Ty>,
    A::Err: IntoFieldErr<Self::Err>,
    B::Err: IntoFieldErr<Self::Err>, 
[src]

impl<'a, F, S, U, This: ?Sized, Mid: ?Sized, OutTy, OutErr> RevGetMultiFieldImpl<'a, This> for NestedFieldPathSet<F, S, U> where
    F: RevGetFieldImpl<'a, This, Ty = Mid, Err = OutErr>,
    FieldPathSet<S, U>: RevGetMultiFieldImpl<'a, Mid, UnnormFields = OutTy>,
    OutErr: IsFieldErr,
    This: 'a,
    Mid: 'a,
    OutTy: 'a + NormalizeFields,
    NestedFieldPathSetOutput<OutTy, OutErr>: 'a + NormalizeFields
[src]

type UnnormFields = NestedFieldPathSetOutput<OutTy, OutErr>

A collection of Results<&'a _,_>s referencing fields.

impl<'a, F, S, This: ?Sized, Mid: ?Sized, OutTy, OutRawTy, OutErr> RevGetMultiFieldMutImpl<'a, This> for NestedFieldPathSet<F, S, UniquePaths> where
    F: RevGetFieldMutImpl<'a, This, Ty = Mid, Err = OutErr>,
    FieldPathSet<S, UniquePaths>: RevGetMultiFieldMutImpl<'a, Mid, UnnormFieldsMut = OutTy, UnnormFieldsRawMut = OutRawTy>,
    This: 'a,
    OutErr: IsFieldErr,
    Mid: 'a,
    OutTy: 'a + NormalizeFields,
    OutRawTy: 'a + NormalizeFields,
    NestedFieldPathSetOutput<OutTy, OutErr>: 'a + NormalizeFields,
    NestedFieldPathSetOutput<OutRawTy, OutErr>: 'a + NormalizeFields
[src]

type UnnormFieldsMut = NestedFieldPathSetOutput<OutTy, OutErr>

This is usually a tuple of Result<&mut _,E: IsFieldErr>s.

type UnnormFieldsRawMut = NestedFieldPathSetOutput<OutRawTy, OutErr>

This is usually a tuple of Result<*mut _,E: IsFieldErr>s.

impl<This, A, B, U> RevIntoFieldImpl<This> for NestedFieldPathSet<A, (B,), U> where
    This: ?Sized,
    A: RevIntoFieldImpl<This>,
    B: RevIntoFieldImpl<A::Ty>,
    A::Ty: Sized,
    Self: RevFieldErr<This, Ty = B::Ty>,
    A::Err: IntoFieldErr<Self::Err>,
    B::Err: IntoFieldErr<Self::Err>, 
[src]

impl<F, S, This, Mid, OutTy, OutErr> RevIntoMultiFieldImpl<This> for NestedFieldPathSet<F, S, UniquePaths> where
    F: RevIntoFieldImpl<This, Ty = Mid, Err = OutErr>,
    FieldPathSet<S, UniquePaths>: RevIntoMultiFieldImpl<Mid, UnnormIntoFields = OutTy>,
    OutTy: NormalizeFields,
    OutErr: IsFieldErr,
    NestedFieldPathSetOutput<OutTy, OutErr>: NormalizeFields
[src]

type UnnormIntoFields = NestedFieldPathSetOutput<OutTy, OutErr>

This is usually a tuple of Result<_, E: IsFieldErr>s.

Auto Trait Implementations

impl<F, S, U> RefUnwindSafe for NestedFieldPathSet<F, S, U> where
    F: RefUnwindSafe,
    S: RefUnwindSafe,
    U: RefUnwindSafe

impl<F, S, U> Send for NestedFieldPathSet<F, S, U> where
    F: Send,
    S: Send,
    U: Send

impl<F, S, U> Sync for NestedFieldPathSet<F, S, U> where
    F: Sync,
    S: Sync,
    U: Sync

impl<F, S, U> Unpin for NestedFieldPathSet<F, S, U> where
    F: Unpin,
    S: Unpin,
    U: Unpin

impl<F, S, U> UnwindSafe for NestedFieldPathSet<F, S, U> where
    F: UnwindSafe,
    S: UnwindSafe,
    U: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<This, T> Array0<T> for This where
    This: ?Sized
[src]

impl<This, V, T> Array0Variant<T, V> for This where
    This: ?Sized
[src]

impl<This, T> ArrayMove0<T> for This where
    This: ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<This, T> IntoStructural<T> for This where
    T: FromStructural<This>, 
[src]

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

impl<'a, Path, This> OptRevGetFieldMut<'a, This> for Path where
    Path: RevGetFieldMutImpl<'a, This, Err = FailedAccess>, 
[src]

impl<Path, This> OptRevIntoField<This> for Path where
    Path: RevIntoFieldImpl<This, Err = FailedAccess>, 
[src]

impl<'a, Path, This> OptRevIntoFieldMut<'a, This> for Path where
    Path: OptRevIntoField<This> + OptRevGetFieldMut<'a, This>, 
[src]

impl<'a, Path, This> OptRevIntoFieldRef<'a, This> for Path where
    Path: OptRevIntoField<This> + OptRevGetFieldMut<'a, This>, 
[src]

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

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

impl<'a, This, Path> RevGetMultiField<'a, This> for Path where
    Path: RevGetMultiFieldImpl<'a, This>,
    This: 'a + ?Sized
[src]

type Fields = <<Path as RevGetMultiFieldImpl<'a, This>>::UnnormFields as NormalizeFields>::Output

This is usually a tuple of Option<&_>s and &_s.

impl<'a, This, Path> RevGetMultiFieldMut<'a, This> for Path where
    Path: RevGetMultiFieldMutImpl<'a, This>,
    This: 'a + ?Sized
[src]

type FieldsMut = <<Path as RevGetMultiFieldMutImpl<'a, This>>::UnnormFieldsMut as NormalizeFields>::Output

This is usually a tuple of Option<&mut _>s and &mut _s.

type FieldsRawMut = <<Path as RevGetMultiFieldMutImpl<'a, This>>::UnnormFieldsRawMut as NormalizeFields>::Output

This is usually a tuple of Option<*mut _>s and *mut _s.

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

impl<'a, Path, This> RevIntoFieldMut<'a, This> for Path where
    Path: RevIntoField<This> + RevGetFieldMut<'a, This>, 
[src]

impl<'a, Path, This> RevIntoFieldRef<'a, This> for Path where
    Path: RevIntoField<This> + RevGetFieldMut<'a, This>, 
[src]

impl<This, Path> RevIntoMultiField<This> for Path where
    Path: RevIntoMultiFieldImpl<This>, 
[src]

type IntoFields = <<Path as RevIntoMultiFieldImpl<This>>::UnnormIntoFields as NormalizeFields>::Output

This is usually a tuple of Option<T>s and Ts.

impl<T> SelfOps for T where
    T: ?Sized
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The error type returned when the conversion fails.

impl<This, T> TryIntoStructural<T> for This where
    T: TryFromStructural<This>, 
[src]

type Error = <T as TryFromStructural<This>>::Error

The error parameter of TryFromError, returned from try_into_structural on conversion error. Read more

impl<T> TypeIdentity for T where
    T: ?Sized
[src]

type Type = T

The same type as Self. Read more