Struct gimli::read::Attribute

source ·
pub struct Attribute<R: Reader> { /* private fields */ }
Expand description

An attribute in a DebuggingInformationEntry, consisting of a name and associated value.

Implementations§

source§

impl<R: Reader> Attribute<R>

source

pub fn name(&self) -> DwAt

Get this attribute’s name.

source

pub fn raw_value(&self) -> AttributeValue<R>

Get this attribute’s raw value.

source

pub fn value(&self) -> AttributeValue<R>

Get this attribute’s normalized value.

Attribute values can potentially be encoded in multiple equivalent forms, and may have special meaning depending on the attribute name. This method converts the attribute value to a normalized form based on the attribute name.

See “Table 7.5: Attribute encodings” and “Table 7.6: Attribute form encodings”.

source

pub fn u8_value(&self) -> Option<u8>

Try to convert this attribute’s value to a u8.

source

pub fn u16_value(&self) -> Option<u16>

Try to convert this attribute’s value to a u16.

source

pub fn udata_value(&self) -> Option<u64>

Try to convert this attribute’s value to an unsigned integer.

source

pub fn sdata_value(&self) -> Option<i64>

Try to convert this attribute’s value to a signed integer.

source

pub fn offset_value(&self) -> Option<R::Offset>

Try to convert this attribute’s value to an offset.

source

pub fn exprloc_value(&self) -> Option<Expression<R>>

Try to convert this attribute’s value to an expression or location buffer.

Expressions and locations may be DW_FORM_block* or DW_FORM_exprloc. The standard doesn’t mention DW_FORM_block* as a possible form, but it is encountered in practice.

source

pub fn string_value(&self, debug_str: &DebugStr<R>) -> Option<R>

Try to return this attribute’s value as a string slice.

If this attribute’s value is either an inline DW_FORM_string string, or a DW_FORM_strp reference to an offset into the .debug_str section, return the attribute’s string value as Some. Other attribute value forms are returned as None.

Warning: this function does not handle all possible string forms. Use Dwarf::attr_string instead.

source

pub fn string_value_sup( &self, debug_str: &DebugStr<R>, debug_str_sup: Option<&DebugStr<R>>, ) -> Option<R>

Try to return this attribute’s value as a string slice.

If this attribute’s value is either an inline DW_FORM_string string, or a DW_FORM_strp reference to an offset into the .debug_str section, or a DW_FORM_strp_sup reference to an offset into a supplementary object file, return the attribute’s string value as Some. Other attribute value forms are returned as None.

Warning: this function does not handle all possible string forms. Use Dwarf::attr_string instead.

Trait Implementations§

source§

impl<R: Clone + Reader> Clone for Attribute<R>

source§

fn clone(&self) -> Attribute<R>

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<R: Debug + Reader> Debug for Attribute<R>

source§

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

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

impl<R: PartialEq + Reader> PartialEq for Attribute<R>

source§

fn eq(&self, other: &Attribute<R>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<R: Copy + Reader> Copy for Attribute<R>

source§

impl<R: Eq + Reader> Eq for Attribute<R>

source§

impl<R: Reader> StructuralPartialEq for Attribute<R>

Auto Trait Implementations§

§

impl<R> Freeze for Attribute<R>
where R: Freeze, <R as Reader>::Offset: Freeze,

§

impl<R> RefUnwindSafe for Attribute<R>

§

impl<R> Send for Attribute<R>
where R: Send, <R as Reader>::Offset: Send,

§

impl<R> Sync for Attribute<R>
where R: Sync, <R as Reader>::Offset: Sync,

§

impl<R> Unpin for Attribute<R>
where R: Unpin, <R as Reader>::Offset: Unpin,

§

impl<R> UnwindSafe for Attribute<R>
where R: UnwindSafe, <R as Reader>::Offset: UnwindSafe,

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<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
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.