pub struct UnitOffset<T = usize>(pub T);Expand description
An offset into the current compilation or type unit.
Tuple Fields§
§0: TImplementations§
Source§impl<T: ReaderOffset> UnitOffset<T>
impl<T: ReaderOffset> UnitOffset<T>
Sourcepub fn is_in_bounds<R>(&self, unit: &UnitHeader<R>) -> boolwhere
R: Reader<Offset = T>,
pub fn is_in_bounds<R>(&self, unit: &UnitHeader<R>) -> boolwhere
R: Reader<Offset = T>,
Return true if this offset is within the entries of the given unit.
This only checks that the offset is within the range of the data for unit entries, not that there is a valid DIE at this offset.
Sourcepub fn to_unit_section_offset<R>(
&self,
unit: &UnitHeader<R>,
) -> UnitSectionOffset<T>where
R: Reader<Offset = T>,
pub fn to_unit_section_offset<R>(
&self,
unit: &UnitHeader<R>,
) -> UnitSectionOffset<T>where
R: Reader<Offset = T>,
Convert an offset to be relative to the start of the section containing the unit, instead of relative to the start of the given unit.
Does not check that the offset is in bounds or valid. This is because often you
will know that the offset came from this unit so it must be valid.
For offsets of uncertain origin, use UnitOffset::is_in_bounds first.
Sourcepub fn to_debug_info_offset<R>(
&self,
unit: &UnitHeader<R>,
) -> Option<DebugInfoOffset<T>>where
R: Reader<Offset = T>,
pub fn to_debug_info_offset<R>(
&self,
unit: &UnitHeader<R>,
) -> Option<DebugInfoOffset<T>>where
R: Reader<Offset = T>,
Convert an offset to be relative to the start of the .debug_info section,
instead of relative to the start of the given unit.
Returns None if the unit is not within the .debug_info section.
Sourcepub fn to_debug_types_offset<R>(
&self,
unit: &UnitHeader<R>,
) -> Option<DebugTypesOffset<T>>where
R: Reader<Offset = T>,
pub fn to_debug_types_offset<R>(
&self,
unit: &UnitHeader<R>,
) -> Option<DebugTypesOffset<T>>where
R: Reader<Offset = T>,
Convert an offset to be relative to the start of the .debug_types section,
instead of relative to the start of the given unit.
Returns None if the unit is not within the .debug_types section.
Trait Implementations§
Source§impl<T: Clone> Clone for UnitOffset<T>
impl<T: Clone> Clone for UnitOffset<T>
Source§fn clone(&self) -> UnitOffset<T>
fn clone(&self) -> UnitOffset<T>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<T: Debug> Debug for UnitOffset<T>
impl<T: Debug> Debug for UnitOffset<T>
Source§impl<T: Hash> Hash for UnitOffset<T>
impl<T: Hash> Hash for UnitOffset<T>
Source§impl<T: Ord> Ord for UnitOffset<T>
impl<T: Ord> Ord for UnitOffset<T>
Source§fn cmp(&self, other: &UnitOffset<T>) -> Ordering
fn cmp(&self, other: &UnitOffset<T>) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl<T: PartialEq> PartialEq for UnitOffset<T>
impl<T: PartialEq> PartialEq for UnitOffset<T>
Source§impl<T: PartialOrd> PartialOrd for UnitOffset<T>
impl<T: PartialOrd> PartialOrd for UnitOffset<T>
impl<T: Copy> Copy for UnitOffset<T>
impl<T: Eq> Eq for UnitOffset<T>
impl<T> StructuralPartialEq for UnitOffset<T>
Auto Trait Implementations§
impl<T> Freeze for UnitOffset<T>where
T: Freeze,
impl<T> RefUnwindSafe for UnitOffset<T>where
T: RefUnwindSafe,
impl<T> Send for UnitOffset<T>where
T: Send,
impl<T> Sync for UnitOffset<T>where
T: Sync,
impl<T> Unpin for UnitOffset<T>where
T: Unpin,
impl<T> UnsafeUnpin for UnitOffset<T>where
T: UnsafeUnpin,
impl<T> UnwindSafe for UnitOffset<T>where
T: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.