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 T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcepub fn to_owned(&self) -> T
pub fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
sourcepub fn clone_into(&self, target: &mut T)
pub fn clone_into(&self, target: &mut T)
🔬 This is a nightly-only experimental API. (
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more