pub struct BtfType<'btf> { /* private fields */ }
Expand description
An undiscriminated btf type
The btf_type_match
can be used to match on the variants of this type
as if it was a rust enum.
You can also use the TryFrom
trait to convert to any of the possible types
.
Implementations§
source§impl<'btf> BtfType<'btf>
impl<'btf> BtfType<'btf>
sourcepub fn is_any_enum(&self) -> bool
pub fn is_any_enum(&self) -> bool
Whether this represents any kind of enum.
sourcepub fn is_core_compat(&self, other: &Self) -> bool
pub fn is_core_compat(&self, other: &Self) -> bool
Whether this btf type is core compatible to other
.
sourcepub fn is_composite(&self) -> bool
pub fn is_composite(&self) -> bool
Whether this type represents a composite type (struct/union).
sourcepub fn next_type(&self) -> Option<Self>
pub fn next_type(&self) -> Option<Self>
If this type implements ReferencesType
, returns the type it references.
sourcepub fn skip_mods_and_typedefs(&self) -> Self
pub fn skip_mods_and_typedefs(&self) -> Self
Given a type, follows the refering type ids until it finds a type that isn’t a modifier or
a BtfKind::Typedef
.
See is_mod.
sourcepub fn alignment(&self) -> Result<NonZeroUsize>
pub fn alignment(&self) -> Result<NonZeroUsize>
Returns the alignment of this type, if this type points to some modifier or typedef, those will be skipped until the underlying type (with an alignment) is found.
Trait Implementations§
impl<'btf> Copy for BtfType<'btf>
Auto Trait Implementations§
impl<'btf> Freeze for BtfType<'btf>
impl<'btf> RefUnwindSafe for BtfType<'btf>
impl<'btf> !Send for BtfType<'btf>
impl<'btf> !Sync for BtfType<'btf>
impl<'btf> Unpin for BtfType<'btf>
impl<'btf> UnwindSafe for BtfType<'btf>
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