Struct abi_stable::type_layout::TypeLayout
source · #[repr(C)]pub struct TypeLayout { /* private fields */ }
Expand description
The layout of a type, also includes metadata about where the type was defined.
Implementations§
source§impl TypeLayout
impl TypeLayout
Gets the SharedVars of the type, containing the slices that many types inside TypeLayout contain ranges into.
sourcepub fn package_and_version(&self) -> (RStr<'static>, VersionStrings)
pub fn package_and_version(&self) -> (RStr<'static>, VersionStrings)
Gets the package and package version where the type was declared.
sourcepub fn package_version(&self) -> VersionStrings
pub fn package_version(&self) -> VersionStrings
Gets the package version for the package where the type was declared.
sourcepub const fn mod_path(&self) -> ModPath
pub const fn mod_path(&self) -> ModPath
Gets the full path to the module where the type was defined.
sourcepub fn extra_checks(&self) -> Option<ExtraChecksStaticRef>
pub fn extra_checks(&self) -> Option<ExtraChecksStaticRef>
Gets a trait object used to check extra properties about the type.
sourcepub const fn get_fields(&self) -> Option<TLFields>
pub const fn get_fields(&self) -> Option<TLFields>
Gets the fields of the type.
Return value
If this a:
-
primitive or opaque type: It returns
None
. -
enum: It returns
Some()
with all the fields in the order that they were declared, ignoring variants. -
structs/unions/prefix types: It returns
Some()
with all the fields in the order that they were declared.
sourcepub const fn is_prefix_kind(&self) -> bool
pub const fn is_prefix_kind(&self) -> bool
Whether this is a prefix-type(module or vtable).
sourcepub const fn is_nonzero(&self) -> bool
pub const fn is_nonzero(&self) -> bool
Gets whether the type is a NonZero type,
which can be put in an Option
while being ffi-safe.
sourcepub fn get_utypeid(&self) -> UTypeId
pub fn get_utypeid(&self) -> UTypeId
Gets the UTypeId
for the type,
which is an ffi safe equivalent of TypeId
.
sourcepub const fn tag(&self) -> &'static Tag
pub const fn tag(&self) -> &'static Tag
Gets the Tag
associated with a type,
a JSON-like datastructure which is another way to
check extra properties about a type.
sourcepub const fn mod_refl_mode(&self) -> ModReflMode
pub const fn mod_refl_mode(&self) -> ModReflMode
Gets the ModReflMode
for the type,
whether this is a module whose definition can be reflected on at runtime.
sourcepub fn data(&self) -> TLData
pub fn data(&self) -> TLData
The interior of the type definition, describing whether the type is a primitive/enum/struct/union and its contents.
sourcepub const fn data_discriminant(&self) -> TLDataDiscriminant
pub const fn data_discriminant(&self) -> TLDataDiscriminant
Describes whether the type is a primitive/enum/struct/union,
every variant corresponds to a TLData
variant of the same name.
sourcepub fn phantom_fields(&self) -> TLFields
pub fn phantom_fields(&self) -> TLFields
Gets the virtual fields that aren’t part of th type definition, but are checked as part of the type
sourcepub fn generics(&self) -> GenericParams
pub fn generics(&self) -> GenericParams
Gets the generic parameters of the type.
sourcepub const fn mono_type_layout(&self) -> &MonoTypeLayout
pub const fn mono_type_layout(&self) -> &MonoTypeLayout
Gets the parts of the type layout that don’t change with generic parameters.
Trait Implementations§
source§impl Clone for TypeLayout
impl Clone for TypeLayout
source§fn clone(&self) -> TypeLayout
fn clone(&self) -> TypeLayout
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for TypeLayout
impl Debug for TypeLayout
source§impl Display for TypeLayout
impl Display for TypeLayout
source§impl GetStaticEquivalent_ for TypeLayout
impl GetStaticEquivalent_ for TypeLayout
§type StaticEquivalent = _static_TypeLayout
type StaticEquivalent = _static_TypeLayout
'static
equivalent of Self
source§impl PartialEq for TypeLayout
impl PartialEq for TypeLayout
source§fn eq(&self, other: &TypeLayout) -> bool
fn eq(&self, other: &TypeLayout) -> bool
self
and other
values to be equal, and is used
by ==
.source§impl StableAbi for TypeLayout
impl StableAbi for TypeLayout
§type IsNonZeroType = False
type IsNonZeroType = False
source§const LAYOUT: &'static TypeLayout = _
const LAYOUT: &'static TypeLayout = _
source§const ABI_CONSTS: AbiConsts = _
const ABI_CONSTS: AbiConsts = _
const
-equivalents of the associated types.impl Copy for TypeLayout
impl Eq for TypeLayout
impl Send for TypeLayout
impl Sync for TypeLayout
Auto Trait Implementations§
Blanket Implementations§
source§impl<T> AlignerFor<1> for T
impl<T> AlignerFor<1> for T
source§impl<T> AlignerFor<1024> for T
impl<T> AlignerFor<1024> for T
§type Aligner = AlignTo1024<T>
type Aligner = AlignTo1024<T>
AlignTo*
type which aligns Self
to ALIGNMENT
.source§impl<T> AlignerFor<128> for T
impl<T> AlignerFor<128> for T
§type Aligner = AlignTo128<T>
type Aligner = AlignTo128<T>
AlignTo*
type which aligns Self
to ALIGNMENT
.source§impl<T> AlignerFor<16> for T
impl<T> AlignerFor<16> for T
source§impl<T> AlignerFor<16384> for T
impl<T> AlignerFor<16384> for T
§type Aligner = AlignTo16384<T>
type Aligner = AlignTo16384<T>
AlignTo*
type which aligns Self
to ALIGNMENT
.source§impl<T> AlignerFor<2> for T
impl<T> AlignerFor<2> for T
source§impl<T> AlignerFor<2048> for T
impl<T> AlignerFor<2048> for T
§type Aligner = AlignTo2048<T>
type Aligner = AlignTo2048<T>
AlignTo*
type which aligns Self
to ALIGNMENT
.source§impl<T> AlignerFor<256> for T
impl<T> AlignerFor<256> for T
§type Aligner = AlignTo256<T>
type Aligner = AlignTo256<T>
AlignTo*
type which aligns Self
to ALIGNMENT
.source§impl<T> AlignerFor<32> for T
impl<T> AlignerFor<32> for T
source§impl<T> AlignerFor<32768> for T
impl<T> AlignerFor<32768> for T
§type Aligner = AlignTo32768<T>
type Aligner = AlignTo32768<T>
AlignTo*
type which aligns Self
to ALIGNMENT
.source§impl<T> AlignerFor<4> for T
impl<T> AlignerFor<4> for T
source§impl<T> AlignerFor<4096> for T
impl<T> AlignerFor<4096> for T
§type Aligner = AlignTo4096<T>
type Aligner = AlignTo4096<T>
AlignTo*
type which aligns Self
to ALIGNMENT
.source§impl<T> AlignerFor<512> for T
impl<T> AlignerFor<512> for T
§type Aligner = AlignTo512<T>
type Aligner = AlignTo512<T>
AlignTo*
type which aligns Self
to ALIGNMENT
.source§impl<T> AlignerFor<64> for T
impl<T> AlignerFor<64> for T
source§impl<T> AlignerFor<8> for T
impl<T> AlignerFor<8> for T
source§impl<T> AlignerFor<8192> for T
impl<T> AlignerFor<8192> for T
§type Aligner = AlignTo8192<T>
type Aligner = AlignTo8192<T>
AlignTo*
type which aligns Self
to ALIGNMENT
.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
source§impl<'a, T> RCowCompatibleRef<'a> for Twhere
T: Clone + 'a,
impl<'a, T> RCowCompatibleRef<'a> for Twhere
T: Clone + 'a,
source§fn as_c_ref(from: &'a T) -> <T as RCowCompatibleRef<'a>>::RefC
fn as_c_ref(from: &'a T) -> <T as RCowCompatibleRef<'a>>::RefC
source§fn as_rust_ref(from: <T as RCowCompatibleRef<'a>>::RefC) -> &'a T
fn as_rust_ref(from: <T as RCowCompatibleRef<'a>>::RefC) -> &'a T
source§impl<S> ROExtAcc for S
impl<S> ROExtAcc for S
source§fn f_get<F>(&self, offset: FieldOffset<S, F, Aligned>) -> &F
fn f_get<F>(&self, offset: FieldOffset<S, F, Aligned>) -> &F
offset
. Read moresource§fn f_get_mut<F>(&mut self, offset: FieldOffset<S, F, Aligned>) -> &mut F
fn f_get_mut<F>(&mut self, offset: FieldOffset<S, F, Aligned>) -> &mut F
offset
. Read moresource§fn f_get_ptr<F, A>(&self, offset: FieldOffset<S, F, A>) -> *const F
fn f_get_ptr<F, A>(&self, offset: FieldOffset<S, F, A>) -> *const F
offset
. Read moresource§fn f_get_mut_ptr<F, A>(&mut self, offset: FieldOffset<S, F, A>) -> *mut F
fn f_get_mut_ptr<F, A>(&mut self, offset: FieldOffset<S, F, A>) -> *mut F
offset
. Read moresource§impl<S> ROExtOps<Aligned> for S
impl<S> ROExtOps<Aligned> for S
source§fn f_replace<F>(&mut self, offset: FieldOffset<S, F, Aligned>, value: F) -> F
fn f_replace<F>(&mut self, offset: FieldOffset<S, F, Aligned>, value: F) -> F
offset
) with value
,
returning the previous value of the field. Read moresource§fn f_get_copy<F>(&self, offset: FieldOffset<S, F, Aligned>) -> Fwhere
F: Copy,
fn f_get_copy<F>(&self, offset: FieldOffset<S, F, Aligned>) -> Fwhere
F: Copy,
source§impl<S> ROExtOps<Unaligned> for S
impl<S> ROExtOps<Unaligned> for S
source§fn f_replace<F>(&mut self, offset: FieldOffset<S, F, Unaligned>, value: F) -> F
fn f_replace<F>(&mut self, offset: FieldOffset<S, F, Unaligned>, value: F) -> F
offset
) with value
,
returning the previous value of the field. Read moresource§fn f_get_copy<F>(&self, offset: FieldOffset<S, F, Unaligned>) -> Fwhere
F: Copy,
fn f_get_copy<F>(&self, offset: FieldOffset<S, F, Unaligned>) -> Fwhere
F: Copy,
source§impl<T> SelfOps for Twhere
T: ?Sized,
impl<T> SelfOps for Twhere
T: ?Sized,
source§fn piped<F, U>(self, f: F) -> U
fn piped<F, U>(self, f: F) -> U
source§fn piped_ref<'a, F, U>(&'a self, f: F) -> U
fn piped_ref<'a, F, U>(&'a self, f: F) -> U
piped
except that the function takes &Self
Useful for functions that take &Self
instead of Self
. Read moresource§fn piped_mut<'a, F, U>(&'a mut self, f: F) -> Uwhere
F: FnOnce(&'a mut Self) -> U,
fn piped_mut<'a, F, U>(&'a mut self, f: F) -> Uwhere
F: FnOnce(&'a mut Self) -> U,
piped
, except that the function takes &mut Self
.
Useful for functions that take &mut Self
instead of Self
.source§fn mutated<F>(self, f: F) -> Self
fn mutated<F>(self, f: F) -> Self
source§fn observe<F>(self, f: F) -> Self
fn observe<F>(self, f: F) -> Self
source§fn as_ref_<T>(&self) -> &T
fn as_ref_<T>(&self) -> &T
AsRef
,
using the turbofish .as_ref_::<_>()
syntax. Read more