pub(crate) enum Tree<D, R>where
    D: Def,
    R: Ref,
{ Seq(Vec<Self>), Alt(Vec<Self>), Def(D), Ref(R), Byte(Byte), }
Expand description

A tree-based representation of a type layout.

Invariants:

  1. All paths through the layout have the same length (in bytes).

Nice-to-haves:

  1. An Alt is never directly nested beneath another Alt.
  2. A Seq is never directly nested beneath another Seq.
  3. Seqs and Alts with a single member do not exist.

Variants§

§

Seq(Vec<Self>)

A sequence of successive layouts.

§

Alt(Vec<Self>)

A choice between alternative layouts.

§

Def(D)

A definition node.

§

Ref(R)

A reference node.

§

Byte(Byte)

A byte node.

Implementations§

A Tree consisting only of a definition node.

A Tree representing an uninhabited type.

A Tree representing a zero-sized type.

A Tree containing a single, uninitialized byte.

A Tree representing the layout of bool.

A Tree whose layout matches that of a u8.

A Tree whose layout accepts exactly the given bit pattern.

A Tree whose layout is a number of the given width.

A Tree whose layout is entirely padding of the given width.

Remove all Def nodes, and all branches of the layout for which f produces false.

Produces true if Tree is an inhabited type; otherwise false.

Produces a new Tree where other is sequenced after self.

Produces a new Tree accepting either self or other as alternative layouts.

Trait Implementations§

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Feeds this value into the given Hasher. Read more
Feeds a slice of this type into the given Hasher. Read more
This method tests for self and other values to be equal, and is used by ==. Read more
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.

Layout§

Note: Unable to compute type layout, possibly due to this type having generic parameters. Layout can only be computed for concrete, fully-instantiated types.