Struct libbpf_rs::btf::types::Typedef

source ·
pub struct Typedef<'btf> { /* private fields */ }
Expand description

A C typedef.

References the original type.

See also libbpf docs

Methods from Deref<Target = BtfType<'btf>>§

source

pub fn type_id(&self) -> TypeId

This type’s type id.

source

pub fn name(&self) -> Option<&'btf CStr>

This type’s name.

source

pub fn kind(&self) -> BtfKind

This type’s kind.

source

pub fn is_mod(&self) -> bool

Whether this represent’s a modifier.

source

pub fn is_any_enum(&self) -> bool

Whether this represents any kind of enum.

source

pub fn is_core_compat(&self, other: &Self) -> bool

Whether this btf type is core compatible to other.

source

pub fn is_composite(&self) -> bool

Whether this type represents a composite type (struct/union).

source

pub fn next_type(&self) -> Option<Self>

If this type implements ReferencesType, returns the type it references.

source

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.

source

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.

See skip_mods_and_typedefs.

Trait Implementations§

source§

impl<'btf> Debug for Typedef<'btf>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<'btf> Deref for Typedef<'btf>

§

type Target = BtfType<'btf>

The resulting type after dereferencing.
source§

fn deref(&self) -> &Self::Target

Dereferences the value.
source§

impl<'btf> ReferencesType<'btf> for Typedef<'btf>

source§

fn referenced_type_id(&self) -> TypeId

The referenced type’s id.
source§

fn referenced_type(&self) -> BtfType<'btf>

The referenced type.
source§

impl<'btf> TryFrom<BtfType<'btf>> for Typedef<'btf>

§

type Error = BtfType<'btf>

The type returned in the event of a conversion error.
source§

fn try_from(t: BtfType<'btf>) -> Result<Self, Self::Error>

Performs the conversion.

Auto Trait Implementations§

§

impl<'btf> Freeze for Typedef<'btf>

§

impl<'btf> RefUnwindSafe for Typedef<'btf>

§

impl<'btf> !Send for Typedef<'btf>

§

impl<'btf> !Sync for Typedef<'btf>

§

impl<'btf> Unpin for Typedef<'btf>

§

impl<'btf> UnwindSafe for Typedef<'btf>

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

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

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.