pub struct ProductTypeLayoutView<'a> {
pub layout: Layout,
pub elements: &'a [ProductTypeElementLayout],
}Expand description
A mirror of ProductType annotated with a Layout.
Fields§
§layout: LayoutThe memoized layout of the product type.
elements: &'a [ProductTypeElementLayout]The fields of the product type with their own layout annotations.
Implementations§
Source§impl ProductTypeLayoutView<'_>
impl ProductTypeLayoutView<'_>
Sourcepub fn algebraic_type(&self) -> AlgebraicType
pub fn algebraic_type(&self) -> AlgebraicType
Convert a ProductTypeLayout back into an AlgebraicType::Product,
removing layout information.
This operation is O(n) in the number of nodes in the argument, and will heap-allocate. It is intended for use in error paths, where performance is a secondary concern.
Trait Implementations§
Source§impl<'a> Clone for ProductTypeLayoutView<'a>
impl<'a> Clone for ProductTypeLayoutView<'a>
Source§fn clone(&self) -> ProductTypeLayoutView<'a>
fn clone(&self) -> ProductTypeLayoutView<'a>
Returns a duplicate 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<'a> Debug for ProductTypeLayoutView<'a>
impl<'a> Debug for ProductTypeLayoutView<'a>
Source§impl<'de> DeserializeSeed<'de> for ProductTypeLayoutView<'_>
impl<'de> DeserializeSeed<'de> for ProductTypeLayoutView<'_>
Source§type Output = ProductValue
type Output = ProductValue
The type produced by using this seed.
Source§fn deserialize<D: Deserializer<'de>>(
self,
de: D,
) -> Result<Self::Output, D::Error>
fn deserialize<D: Deserializer<'de>>( self, de: D, ) -> Result<Self::Output, D::Error>
Equivalent to the more common
Deserialize::deserialize associated function,
except with some initial piece of data (the seed self) passed in.Source§impl HasLayout for ProductTypeLayoutView<'_>
impl HasLayout for ProductTypeLayoutView<'_>
Source§impl<'a> PartialEq for ProductTypeLayoutView<'a>
impl<'a> PartialEq for ProductTypeLayoutView<'a>
Source§impl<'de> ProductVisitor<'de> for ProductTypeLayoutView<'_>
impl<'de> ProductVisitor<'de> for ProductTypeLayoutView<'_>
Source§type Output = ProductValue
type Output = ProductValue
The resulting product.
Source§fn product_name(&self) -> Option<&str>
fn product_name(&self) -> Option<&str>
Returns the name of the product, if any.
Source§fn product_len(&self) -> usize
fn product_len(&self) -> usize
Returns the length of the product.
Source§fn visit_seq_product<A: SeqProductAccess<'de>>(
self,
tup: A,
) -> Result<Self::Output, A::Error>
fn visit_seq_product<A: SeqProductAccess<'de>>( self, tup: A, ) -> Result<Self::Output, A::Error>
The input contains an unnamed product.
Source§fn visit_named_product<A: NamedProductAccess<'de>>(
self,
_: A,
) -> Result<Self::Output, A::Error>
fn visit_named_product<A: NamedProductAccess<'de>>( self, _: A, ) -> Result<Self::Output, A::Error>
The input contains a named product.
Source§fn product_kind(&self) -> ProductKind
fn product_kind(&self) -> ProductKind
Returns the kind of the product.
impl<'a> Eq for ProductTypeLayoutView<'a>
impl<'a> StructuralPartialEq for ProductTypeLayoutView<'a>
Auto Trait Implementations§
impl<'a> Freeze for ProductTypeLayoutView<'a>
impl<'a> RefUnwindSafe for ProductTypeLayoutView<'a>
impl<'a> Send for ProductTypeLayoutView<'a>
impl<'a> Sync for ProductTypeLayoutView<'a>
impl<'a> Unpin for ProductTypeLayoutView<'a>
impl<'a> UnwindSafe for ProductTypeLayoutView<'a>
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.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