pub struct TyLayout<'a, Ty> {
pub ty: Ty,
pub details: &'a LayoutDetails,
}
The details of the layout of a type, alongside the type itself.
Provides various type traversal APIs (e.g., recursing into fields).
Note that the details are NOT guaranteed to always be identical
to those obtained from layout_of(ty)
, as we need to produce
layouts for which Rust types do not exist, such as enum variants
or synthetic fields of enums (i.e., discriminants) and fat pointers.
True if this layout is an aggregate containing fields of only
a single type (e.g., (u32, u32)
). Such aggregates are often
special-cased in ABIs.
Note: We generally ignore fields of zero-sized type when computing
this value (cc #56877).
This is public so that it can be used in unit tests, but
should generally only be relevant to the ABI details of
specific targets.
Returns true if the layout corresponds to an unsized type.
Returns true if the type is a ZST and not unsized.
Performs copy-assignment from source
. Read more
This method tests for self
and other
values to be equal, and is used by ==
. Read more
This method tests for !=
.
Formats the value using the given formatter. Read more
The resulting type after dereferencing.
Feeds this value into the given [Hasher
]. Read more
Feeds a slice of this type into the given [Hasher
]. Read more
Creates owned data from borrowed data, usually by cloning. Read more
🔬 This is a nightly-only experimental API. (toowned_clone_into
)
recently added
Uses borrowed data to replace owned data, usually by cloning. Read more
🔬 This is a nightly-only experimental API. (try_from
)
The type returned in the event of a conversion error.
🔬 This is a nightly-only experimental API. (try_from
)
Immutably borrows from an owned value. Read more
🔬 This is a nightly-only experimental API. (get_type_id
)
this method will likely be replaced by an associated static
Mutably borrows from an owned value. Read more
🔬 This is a nightly-only experimental API. (try_from
)
The type returned in the event of a conversion error.
🔬 This is a nightly-only experimental API. (try_from
)
Create an error for a missing method specialization. Defaults to panicking with type, trait & method names. S
is the encoder/decoder state type, T
is the type being encoded/decoded, and the arguments are the names of the trait and method that should've been overridden. Read more