pub(crate) enum FieldInnerTy<'ty> {
Option(&'ty Type),
Vec(&'ty Type),
Plain(&'ty Type),
}
Expand description
Inner type of a field and type of wrapper.
Variants§
Option(&'ty Type)
Field is wrapped in a Option<$inner>
.
Vec(&'ty Type)
Field is wrapped in a Vec<$inner>
.
Plain(&'ty Type)
Field isn’t wrapped in an outer type.
Implementations§
Source§impl<'ty> FieldInnerTy<'ty>
impl<'ty> FieldInnerTy<'ty>
Sourcepub(crate) fn from_type(ty: &'ty Type) -> Self
pub(crate) fn from_type(ty: &'ty Type) -> Self
Returns inner type for a field, if there is one.
- If
ty
is anOption<Inner>
, returnsFieldInnerTy::Option(Inner)
. - If
ty
is aVec<Inner>
, returnsFieldInnerTy::Vec(Inner)
. - Otherwise returns
FieldInnerTy::Plain(ty)
.
Sourcepub(crate) fn will_iterate(&self) -> bool
pub(crate) fn will_iterate(&self) -> bool
Returns true
if FieldInnerTy::with
will result in iteration for this inner type (i.e.
that cloning might be required for values moved in the loop body).
Sourcepub(crate) fn inner_type(&self) -> &'ty Type
pub(crate) fn inner_type(&self) -> &'ty Type
Returns the inner type.
Sourcepub(crate) fn with(
&self,
binding: impl ToTokens,
inner: impl ToTokens,
) -> TokenStream
pub(crate) fn with( &self, binding: impl ToTokens, inner: impl ToTokens, ) -> TokenStream
Surrounds inner
with destructured wrapper type, exposing inner type as binding
.
pub(crate) fn span(&self) -> Span
Trait Implementations§
Source§impl<'ty> Clone for FieldInnerTy<'ty>
impl<'ty> Clone for FieldInnerTy<'ty>
Source§fn clone(&self) -> FieldInnerTy<'ty>
fn clone(&self) -> FieldInnerTy<'ty>
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 moreimpl<'ty> Copy for FieldInnerTy<'ty>
Auto Trait Implementations§
impl<'ty> Freeze for FieldInnerTy<'ty>
impl<'ty> RefUnwindSafe for FieldInnerTy<'ty>
impl<'ty> !Send for FieldInnerTy<'ty>
impl<'ty> !Sync for FieldInnerTy<'ty>
impl<'ty> Unpin for FieldInnerTy<'ty>
impl<'ty> UnwindSafe for FieldInnerTy<'ty>
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<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more