pub struct Attributes { /* private fields */ }
Expand description
Attributes associated with a specific IR structure.
Implementations§
Source§impl Attributes
impl Attributes
pub fn get_set<S>(&self, key: S) -> Option<&VecSet<u32>>where
S: Into<SetAttribute>,
Sourcepub fn copy_from<A>(&mut self, other: Attributes, keys: Vec<A>)
pub fn copy_from<A>(&mut self, other: Attributes, keys: Vec<A>)
self
copys (i.e., assigns the same values) the attributes in other
.
However, we only copy attributes in keys
(i.e.. we don’t copy
all attributes in other
, only the ones that we specify).
If a key
is not present in other
, then we ignore that key
.
Example: suppose
self: A->10, B->5
other: A->15, C->5
keys: A, D
Then self gets: A->15 B->5. (D is ignored since it’s not present in other
and C is ignored since it’s not keys.)
Sourcepub fn add_span(self, span: GPosIdx) -> Attributes
pub fn add_span(self, span: GPosIdx) -> Attributes
Set the span information
pub fn to_string_with<F, S>( &self, sep: &'static str, fmt: F, set_fmt: S, ) -> String
Trait Implementations§
Source§impl Clone for Attributes
impl Clone for Attributes
Source§fn clone(&self) -> Attributes
fn clone(&self) -> Attributes
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for Attributes
impl Debug for Attributes
Source§impl Default for Attributes
impl Default for Attributes
Source§fn default() -> Attributes
fn default() -> Attributes
Returns the “default value” for a type. Read more
Source§impl PartialEq for Attributes
impl PartialEq for Attributes
Source§impl TryFrom<Vec<ParseAttributeWrapper>> for Attributes
impl TryFrom<Vec<ParseAttributeWrapper>> for Attributes
Source§impl WithPos for Attributes
impl WithPos for Attributes
impl Eq for Attributes
Auto Trait Implementations§
impl Freeze for Attributes
impl RefUnwindSafe for Attributes
impl Send for Attributes
impl Sync for Attributes
impl Unpin for Attributes
impl UnwindSafe for Attributes
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§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
Checks if this value is equivalent to the given key. Read more
§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
Compare self to
key
and return true
if they are equal.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>
Converts
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>
Converts
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 more