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
impl Eq for HashEntry
impl StructuralEq for HashEntry
Auto Trait Implementations
impl !RefUnwindSafe for HashEntry
impl !Send for HashEntry
impl !Sync for HashEntry
impl Unpin for HashEntry
impl !UnwindSafe for HashEntry
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more