From d552ae9beae6404c13548b98ec7a7ec4e6b3dd90 Mon Sep 17 00:00:00 2001 From: Glenn Smith Date: Thu, 21 Jul 2022 15:24:16 -0400 Subject: [Rust API] Better name for this trait fn, more CC support --- rust/src/rc.rs | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'rust/src/rc.rs') diff --git a/rust/src/rc.rs b/rust/src/rc.rs index b21b7b94..a65403e2 100644 --- a/rust/src/rc.rs +++ b/rust/src/rc.rs @@ -135,6 +135,15 @@ impl<'a, T> Guard<'a, T> { } } +impl<'a, T> Guard<'a, T> +where + T: RefCountable, +{ + pub fn clone(&self) -> Ref { + unsafe { ::inc_ref(&self.contents) } + } +} + impl<'a, T> AsRef for Guard<'a, T> { fn as_ref(&self) -> &T { &self.contents -- cgit v1.3.1