summaryrefslogtreecommitdiff
path: root/rust/src/rc.rs
diff options
context:
space:
mode:
authorGlenn Smith <glenn@vector35.com>2022-07-21 15:24:16 -0400
committerGlenn Smith <glenn@vector35.com>2022-09-29 21:02:22 -0400
commitd552ae9beae6404c13548b98ec7a7ec4e6b3dd90 (patch)
tree00a2696b2a3a33b1ac5bb058801fdea9f1a38c03 /rust/src/rc.rs
parent2e18783a2f6e29c225d177e8a0fb866a9c9d85df (diff)
[Rust API] Better name for this trait fn, more CC support
Diffstat (limited to 'rust/src/rc.rs')
-rw-r--r--rust/src/rc.rs9
1 files changed, 9 insertions, 0 deletions
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<T> {
+ unsafe { <T as RefCountable>::inc_ref(&self.contents) }
+ }
+}
+
impl<'a, T> AsRef<T> for Guard<'a, T> {
fn as_ref(&self) -> &T {
&self.contents