Struct yash_syntax::alias::HashEntry
source · [−]Expand description
Wrapper of Alias
for inserting into a hash set.
A HashEntry
wraps an Alias
in Rc
so that the alias definition can be referred to even
after the definition is removed. The Hash
and PartialEq
implementation for HashEntry
compares only names.
let mut entries = std::collections::HashSet::new();
let name = "foo";
let origin = yash_syntax::source::Location::dummy("");
let old = yash_syntax::alias::HashEntry::new(
name.to_string(), "old".to_string(), false, origin.clone());
let new = yash_syntax::alias::HashEntry::new(
name.to_string(), "new".to_string(), false, origin);
entries.insert(old);
let old = entries.replace(new).unwrap();
assert_eq!(old.0.replacement, "old");
assert_eq!(entries.get(name).unwrap().0.replacement, "new");
Tuple Fields
0: Rc<Alias>
Implementations
Trait Implementations
Auto Trait Implementations
impl !RefUnwindSafe for HashEntry
impl !UnwindSafe for HashEntry
Blanket Implementations
Mutably borrows from an owned value. Read more