You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
#[doc = "The caller must ensure that this pointer is being traced correctly by appearing in the [`trace`](GarbageCollected::trace)"]
503
535
#[doc = "implementation of the object that owns the pointer. Between initializing the pointer and calling `get()`, the pointer must be reachable by the garbage collector."]
504
-
pubunsafefn get(&self) -> Option<&T> {
536
+
pubunsafefn get(&self) -> Option<T> {
505
537
let ptr = self.inner.get();
506
538
if ptr.is_null(){
507
539
None
508
540
} else {
509
541
// SAFETY: Either this is a strong reference and the pointer is valid according
510
542
// to the safety contract of this method, or this is a weak reference and the
511
543
// ptr will be null if it was collected.
512
-
Some(unsafe{&*get_object_from_rust_obj(ptr)})
544
+
Some(unsafe{&*get_value_from_rust_obj(ptr)})
513
545
}
514
546
}
515
547
}
@@ -607,7 +639,7 @@ macro_rules! persistent {
607
639
} else {
608
640
// SAFETY: Either this is a strong reference and the pointer is always valid
609
641
// or this is a weak reference and the ptr will be null if it was collected.
610
-
Some(unsafe{&*get_object_from_rust_obj(ptr)})
642
+
Some(unsafe{&*get_value_from_rust_obj(ptr)})
611
643
}
612
644
}
613
645
@@ -661,40 +693,6 @@ persistent! {
661
693
WeakPersistent
662
694
}
663
695
664
-
/// UnsafePtr is used to refer to an on-heap object from the stack.
665
-
#[derive(Clone,Copy)]
666
-
pubstructUnsafePtr<T:GarbageCollected>{
667
-
pointer:NonNull<RustObj>,
668
-
_phantom:PhantomData<T>,
669
-
}
670
-
671
-
impl<T:GarbageCollected>UnsafePtr<T>{
672
-
/// Create a new UnsafePtr.
673
-
///
674
-
/// # Safety
675
-
///
676
-
/// The caller must ensure that the returned pointer is always stored on
677
-
/// the stack, or is safely moved into one of the other cppgc pointer types.
0 commit comments