libbpf_rs::btf::types

Struct DataSec

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

An ELF’s data section, such as .data, .bss or .rodata.

See also libbpf docs

Implementations§

Source§

impl<'btf> DataSec<'btf>

Source

pub fn is_empty(&self) -> bool

Whether this type has no members

Source

pub fn len(&self) -> usize

How many members this DataSec has

Source

pub fn get(&self, index: usize) -> Option<VarSecInfo>

Get a VarSecInfo 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 = VarSecInfo> + 'btf

Returns an iterator over the VarSecInfo’s of the DataSec

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 DataSec<'btf>

Source§

fn clone(&self) -> DataSec<'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 DataSec<'btf>

Source§

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

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

impl<'btf> Deref for DataSec<'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 DataSec<'btf>

Source§

fn size(&self) -> usize

The size of the described type.
Source§

impl<'btf> TryFrom<BtfType<'btf>> for DataSec<'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 DataSec<'btf>

Auto Trait Implementations§

§

impl<'btf> Freeze for DataSec<'btf>

§

impl<'btf> RefUnwindSafe for DataSec<'btf>

§

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

§

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

§

impl<'btf> Unpin for DataSec<'btf>

§

impl<'btf> UnwindSafe for DataSec<'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.