pub struct Attribute<R: Reader> { /* private fields */ }
Expand description
An attribute in a DebuggingInformationEntry
, consisting of a name and
associated value.
Implementations
sourceimpl<R: Reader> Attribute<R>
impl<R: Reader> Attribute<R>
sourcepub fn raw_value(&self) -> AttributeValue<R>
pub fn raw_value(&self) -> AttributeValue<R>
Get this attribute’s raw value.
sourcepub fn value(&self) -> AttributeValue<R>
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”.
sourcepub fn udata_value(&self) -> Option<u64>
pub fn udata_value(&self) -> Option<u64>
Try to convert this attribute’s value to an unsigned integer.
sourcepub fn sdata_value(&self) -> Option<i64>
pub fn sdata_value(&self) -> Option<i64>
Try to convert this attribute’s value to a signed integer.
sourcepub fn offset_value(&self) -> Option<R::Offset>
pub fn offset_value(&self) -> Option<R::Offset>
Try to convert this attribute’s value to an offset.
sourcepub fn exprloc_value(&self) -> Option<Expression<R>>
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.
sourcepub fn string_value(&self, debug_str: &DebugStr<R>) -> Option<R>
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.
sourcepub fn string_value_sup(
&self,
debug_str: &DebugStr<R>,
debug_str_sup: Option<&DebugStr<R>>
) -> Option<R>
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
impl<R: Copy + Reader> Copy for Attribute<R>
impl<R: Eq + Reader> Eq for Attribute<R>
impl<R: Reader> StructuralEq for Attribute<R>
impl<R: Reader> StructuralPartialEq for Attribute<R>
Auto Trait Implementations
impl<R> RefUnwindSafe for Attribute<R> where
R: RefUnwindSafe,
<R as Reader>::Offset: RefUnwindSafe,
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
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcepub fn to_owned(&self) -> T
pub fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
sourcepub fn clone_into(&self, target: &mut T)
pub fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more