add RocRefcounted to SendSafe types

This commit is contained in:
Brendan Hansknecht 2024-12-10 19:34:54 -08:00
parent f8b0be725c
commit 0e162a767d
No known key found for this signature in database
GPG key ID: 0EA784685083E75B
2 changed files with 31 additions and 0 deletions

View file

@ -860,6 +860,23 @@ where
unsafe impl<T> Send for SendSafeRocList<T> where T: Send + RocRefcounted {}
impl<T> RocRefcounted for SendSafeRocList<T>
where
T: RocRefcounted,
{
fn inc(&mut self) {
self.0.inc()
}
fn dec(&mut self) {
self.0.dec()
}
fn is_refcounted() -> bool {
true
}
}
impl<T> Clone for SendSafeRocList<T>
where
T: Clone + RocRefcounted,

View file

@ -764,6 +764,20 @@ pub struct SendSafeRocStr(RocStr);
unsafe impl Send for SendSafeRocStr {}
impl RocRefcounted for SendSafeRocStr {
fn inc(&mut self) {
self.0.inc()
}
fn dec(&mut self) {
self.0.dec()
}
fn is_refcounted() -> bool {
true
}
}
impl Clone for SendSafeRocStr {
fn clone(&self) -> Self {
if self.0.is_readonly() {