From ad7f5293db22e23d8d50077aa99f5d7a904092fc Mon Sep 17 00:00:00 2001 From: Michael Krasnitski Date: Fri, 6 Jan 2023 14:13:55 -0500 Subject: Rust API: Additional Cleanup --- rust/src/rc.rs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'rust/src/rc.rs') diff --git a/rust/src/rc.rs b/rust/src/rc.rs index 57deddc3..4ffecb3f 100644 --- a/rust/src/rc.rs +++ b/rust/src/rc.rs @@ -16,6 +16,7 @@ use std::borrow::Borrow; use std::fmt::{Debug, Display, Formatter}; +use std::hash::{Hash, Hasher}; use std::marker::PhantomData; use std::mem; use std::ops::{Deref, DerefMut}; @@ -118,7 +119,13 @@ impl PartialEq for Ref { } } -impl Eq for Ref {} +impl Eq for Ref {} + +impl Hash for Ref { + fn hash(&self, state: &mut H) { + self.contents.hash(state); + } +} // Guard provides access to a core-allocated resource whose // reference is held indirectly (e.g. a core-allocated array @@ -147,7 +154,7 @@ impl<'a, T> Guard<'a, T> where T: RefCountable, { - #[allow(clippy::should_implement_trait)] // This _is_ out own (lite) version of that trait + #[allow(clippy::should_implement_trait)] // This _is_ out own (lite) version of that trait pub fn clone(&self) -> Ref { unsafe { ::inc_ref(&self.contents) } } -- cgit v1.3.1