Struct rustc_ap_rustc_target::abi::TyAndLayout [−][src]
pub struct TyAndLayout<'a, Ty> { pub ty: Ty, pub layout: &'a Layout, }
Expand description
The layout of a type, alongside the type itself. Provides various type traversal APIs (e.g., recursing into fields).
Note that the layout is NOT guaranteed to always be identical
to that 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.
Fields
ty: Ty
layout: &'a Layout
Implementations
impl<'a, Ty> TyAndLayout<'a, Ty>
[src]
impl<'a, Ty> TyAndLayout<'a, Ty>
[src]pub fn homogeneous_aggregate<C>(
&self,
cx: &C
) -> Result<HomogeneousAggregate, Heterogeneous> where
Ty: TyAndLayoutMethods<'a, C> + Copy,
C: LayoutOf<Ty = Ty, TyAndLayout = Self>,
[src]
pub fn homogeneous_aggregate<C>(
&self,
cx: &C
) -> Result<HomogeneousAggregate, Heterogeneous> where
Ty: TyAndLayoutMethods<'a, C> + Copy,
C: LayoutOf<Ty = Ty, TyAndLayout = Self>,
[src]Returns Homogeneous
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 (see #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.
impl<'a, Ty> TyAndLayout<'a, Ty>
[src]
impl<'a, Ty> TyAndLayout<'a, Ty>
[src]pub fn for_variant<C>(self, cx: &C, variant_index: VariantIdx) -> Self where
Ty: TyAndLayoutMethods<'a, C>,
C: LayoutOf<Ty = Ty>,
[src]
Ty: TyAndLayoutMethods<'a, C>,
C: LayoutOf<Ty = Ty>,
pub fn field<C>(self, cx: &C, i: usize) -> C::TyAndLayout where
Ty: TyAndLayoutMethods<'a, C>,
C: LayoutOf<Ty = Ty>,
[src]
pub fn field<C>(self, cx: &C, i: usize) -> C::TyAndLayout where
Ty: TyAndLayoutMethods<'a, C>,
C: LayoutOf<Ty = Ty>,
[src]Callers might want to use C: LayoutOf<Ty=Ty, TyAndLayout: MaybeResult<Self>>
to allow recursion (see might_permit_zero_init
below for an example).
pub fn pointee_info_at<C>(self, cx: &C, offset: Size) -> Option<PointeeInfo> where
Ty: TyAndLayoutMethods<'a, C>,
C: LayoutOf<Ty = Ty>,
[src]
Ty: TyAndLayoutMethods<'a, C>,
C: LayoutOf<Ty = Ty>,
impl<'a, Ty> TyAndLayout<'a, Ty>
[src]
impl<'a, Ty> TyAndLayout<'a, Ty>
[src]pub fn is_unsized(&self) -> bool
[src]
pub fn is_unsized(&self) -> bool
[src]Returns true
if the layout corresponds to an unsized type.
pub fn might_permit_raw_init<C, E>(self, cx: &C, zero: bool) -> Result<bool, E> where
Self: Copy,
Ty: TyAndLayoutMethods<'a, C>,
C: LayoutOf<Ty = Ty, TyAndLayout: MaybeResult<Self, Error = E>> + HasDataLayout,
[src]
pub fn might_permit_raw_init<C, E>(self, cx: &C, zero: bool) -> Result<bool, E> where
Self: Copy,
Ty: TyAndLayoutMethods<'a, C>,
C: LayoutOf<Ty = Ty, TyAndLayout: MaybeResult<Self, Error = E>> + HasDataLayout,
[src]Determines if this type permits “raw” initialization by just transmuting some
memory into an instance of T
.
zero
indicates if the memory is zero-initialized, or alternatively
left entirely uninitialized.
This is conservative: in doubt, it will answer true
.
FIXME: Once we removed all the conservatism, we could alternatively create an all-0/all-undef constant and run the const value validator to see if this is a valid value for the given type.
Methods from Deref<Target = &'a Layout>
Trait Implementations
impl<'a, Ty: Clone> Clone for TyAndLayout<'a, Ty>
[src]
impl<'a, Ty: Clone> Clone for TyAndLayout<'a, Ty>
[src]fn clone(&self) -> TyAndLayout<'a, Ty>
[src]
fn clone(&self) -> TyAndLayout<'a, Ty>
[src]Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]Performs copy-assignment from source
. Read more
impl<'a, Ty: Debug> Debug for TyAndLayout<'a, Ty>
[src]
impl<'a, Ty: Debug> Debug for TyAndLayout<'a, Ty>
[src]impl<'a, Ty> Deref for TyAndLayout<'a, Ty>
[src]
impl<'a, Ty> Deref for TyAndLayout<'a, Ty>
[src]impl<'a, Ty: Hash> Hash for TyAndLayout<'a, Ty>
[src]
impl<'a, Ty: Hash> Hash for TyAndLayout<'a, Ty>
[src]impl<'a, Ty: PartialEq> PartialEq<TyAndLayout<'a, Ty>> for TyAndLayout<'a, Ty>
[src]
impl<'a, Ty: PartialEq> PartialEq<TyAndLayout<'a, Ty>> for TyAndLayout<'a, Ty>
[src]fn eq(&self, other: &TyAndLayout<'a, Ty>) -> bool
[src]
fn eq(&self, other: &TyAndLayout<'a, Ty>) -> bool
[src]This method tests for self
and other
values to be equal, and is used
by ==
. Read more
fn ne(&self, other: &TyAndLayout<'a, Ty>) -> bool
[src]
fn ne(&self, other: &TyAndLayout<'a, Ty>) -> bool
[src]This method tests for !=
.
impl<'a, Ty: Copy> Copy for TyAndLayout<'a, Ty>
[src]
impl<'a, Ty: Eq> Eq for TyAndLayout<'a, Ty>
[src]
impl<'a, Ty> StructuralEq for TyAndLayout<'a, Ty>
[src]
impl<'a, Ty> StructuralPartialEq for TyAndLayout<'a, Ty>
[src]
Auto Trait Implementations
impl<'a, Ty> RefUnwindSafe for TyAndLayout<'a, Ty> where
Ty: RefUnwindSafe,
Ty: RefUnwindSafe,
impl<'a, Ty> Send for TyAndLayout<'a, Ty> where
Ty: Send,
Ty: Send,
impl<'a, Ty> Sync for TyAndLayout<'a, Ty> where
Ty: Sync,
Ty: Sync,
impl<'a, Ty> Unpin for TyAndLayout<'a, Ty> where
Ty: Unpin,
Ty: Unpin,
impl<'a, Ty> UnwindSafe for TyAndLayout<'a, Ty> where
Ty: UnwindSafe,
Ty: UnwindSafe,
Blanket Implementations
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]pub fn borrow_mut(&mut self) -> &mut T
[src]
pub fn borrow_mut(&mut self) -> &mut T
[src]Mutably borrows from an owned value. Read more
impl<Q, K> Equivalent<K> for Q where
K: Borrow<Q> + ?Sized,
Q: Eq + ?Sized,
[src]
impl<Q, K> Equivalent<K> for Q where
K: Borrow<Q> + ?Sized,
Q: Eq + ?Sized,
[src]pub fn equivalent(&self, key: &K) -> bool
[src]
pub fn equivalent(&self, key: &K) -> bool
[src]Compare self to key
and return true
if they are equal.
impl<T> Instrument for T
[src]
impl<T> Instrument for T
[src]fn instrument(self, span: Span) -> Instrumented<Self>
[src]
fn instrument(self, span: Span) -> Instrumented<Self>
[src]Instruments this type with the provided Span
, returning an
Instrumented
wrapper. Read more
fn in_current_span(self) -> Instrumented<Self>
[src]
fn in_current_span(self) -> Instrumented<Self>
[src]impl<T> MaybeResult<T> for T
[src]
impl<T> MaybeResult<T> for T
[src]impl<T> Same<T> for T
impl<T> Same<T> for T
type Output = T
type Output = T
Should always be Self
impl<T> ToOwned for T where
T: Clone,
[src]
impl<T> ToOwned for T where
T: Clone,
[src]type Owned = T
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn to_owned(&self) -> T
[src]Creates owned data from borrowed data, usually by cloning. Read more
pub fn clone_into(&self, target: &mut T)
[src]
pub fn clone_into(&self, target: &mut T)
[src]🔬 This is a nightly-only experimental API. (toowned_clone_into
)
recently added
Uses borrowed data to replace owned data, usually by cloning. Read more
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
pub fn vzip(self) -> V
impl<'a, T> Captures<'a> for T where
T: ?Sized,
[src]
T: ?Sized,