pub struct ScopedLabelIndices {
labels: BTreeMap<String, Vec<ScopedLabel>>,
}Expand description
Scoped label indices that track labels with their scope information
Fields§
§labels: BTreeMap<String, Vec<ScopedLabel>>Map of label name to all its definitions with scope info
Implementations§
Source§impl ScopedLabelIndices
impl ScopedLabelIndices
Sourcepub fn insert(
&mut self,
name: String,
offset: usize,
scope_id: &ScopeId,
) -> Result<(), LabelError>
pub fn insert( &mut self, name: String, offset: usize, scope_id: &ScopeId, ) -> Result<(), LabelError>
Insert a label with scope information Returns an error if the label already exists in the same scope
Sourcepub fn get(
&self,
name: &str,
current_scope: &ScopeId,
) -> Result<Option<usize>, LabelError>
pub fn get( &self, name: &str, current_scope: &ScopeId, ) -> Result<Option<usize>, LabelError>
Get the label offset for a given name, considering scope Returns the label from the deepest matching scope Returns an error if duplicate labels are found in sibling scopes when cross-referencing
Sourcepub fn get_any(&self, name: &str) -> Option<usize>
pub fn get_any(&self, name: &str) -> Option<usize>
Get any label offset for a given name, regardless of scope Used for jump tables which may reference labels in any scope Returns the first matching label if there are multiple
Sourcepub fn extend(&mut self, other: ScopedLabelIndices)
pub fn extend(&mut self, other: ScopedLabelIndices)
Extend this indices with another set of indices
Sourcepub fn iter(&self) -> impl Iterator<Item = (&String, &Vec<ScopedLabel>)>
pub fn iter(&self) -> impl Iterator<Item = (&String, &Vec<ScopedLabel>)>
Iterate over all labels
Sourcepub fn update_offsets(&mut self, offset_mapping: &BTreeMap<usize, usize>)
pub fn update_offsets(&mut self, offset_mapping: &BTreeMap<usize, usize>)
Update label offsets using a mapping from old offsets to new offsets This is used after jump relaxation to update label positions
Trait Implementations§
Source§impl Clone for ScopedLabelIndices
impl Clone for ScopedLabelIndices
Source§impl Debug for ScopedLabelIndices
impl Debug for ScopedLabelIndices
Source§impl Default for ScopedLabelIndices
impl Default for ScopedLabelIndices
impl Eq for ScopedLabelIndices
Source§impl Ord for ScopedLabelIndices
impl Ord for ScopedLabelIndices
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialEq for ScopedLabelIndices
impl PartialEq for ScopedLabelIndices
Source§impl PartialOrd for ScopedLabelIndices
impl PartialOrd for ScopedLabelIndices
impl StructuralPartialEq for ScopedLabelIndices
Auto Trait Implementations§
impl Freeze for ScopedLabelIndices
impl RefUnwindSafe for ScopedLabelIndices
impl Send for ScopedLabelIndices
impl Sync for ScopedLabelIndices
impl Unpin for ScopedLabelIndices
impl UnsafeUnpin for ScopedLabelIndices
impl UnwindSafe for ScopedLabelIndices
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,
§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<S, T> Upcast<T> for S
impl<S, T> Upcast<T> for S
§impl<T> WithSubscriber for T
impl<T> WithSubscriber for T
§fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘwhere
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘwhere
S: Into<Dispatch>,
§fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ
fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ
Layout§
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...) attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.
Size: 24 bytes