libbpf_rs::btf::types

Struct Enum

Source
pub struct Enum<'btf> { /* private fields */ }
Expand description

An Enum of at most 32 bits.

See also libbpf docs

Implementations§

Source§

impl<'btf> Enum<'btf>

Source

pub fn is_empty(&self) -> bool

Whether this type has no members

Source

pub fn len(&self) -> usize

How many members this Enum has

Source

pub fn get(&self, index: usize) -> Option<EnumMember<'btf>>

Get a EnumMember at a given index

§Errors

This function returns None when the index is out of bounds.

Source

pub fn iter( &'btf self, ) -> impl ExactSizeIterator<Item = EnumMember<'btf>> + 'btf

Returns an iterator over the EnumMember’s of the Enum

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 OsStr>

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> Clone for Enum<'btf>

Source§

fn clone(&self) -> Enum<'btf>

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'btf> Debug for Enum<'btf>

Source§

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

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

impl<'btf> Deref for Enum<'btf>

Source§

type Target = BtfType<'btf>

The resulting type after dereferencing.
Source§

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

Dereferences the value.
Source§

impl<'btf> HasSize<'btf> for Enum<'btf>

Source§

fn size(&self) -> usize

The size of the described type.
Source§

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

Source§

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.
Source§

impl<'btf> Copy for Enum<'btf>

Auto Trait Implementations§

§

impl<'btf> Freeze for Enum<'btf>

§

impl<'btf> RefUnwindSafe for Enum<'btf>

§

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

§

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

§

impl<'btf> Unpin for Enum<'btf>

§

impl<'btf> UnwindSafe for Enum<'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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

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>,

Source§

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.