]> Repositorios git - scryer-prolog.git/commitdiff
Added value method to get the generic type from TypedArenaPtr
authorFayeed Pawaskar <[email protected]>
Mon, 4 Sep 2023 08:41:30 +0000 (14:11 +0530)
committerFayeed Pawaskar <[email protected]>
Mon, 4 Sep 2023 08:41:30 +0000 (14:11 +0530)
src/arena.rs

index 9434b28d76cc06f75a55d2681345bf3c28232265..8a12fdf3200868d4aa96ae9907ffc44c82b4a6f6 100644 (file)
@@ -187,6 +187,12 @@ impl ArenaHeader {
 #[derive(Debug)]
 pub struct TypedArenaPtr<T: ?Sized>(ptr::NonNull<T>);
 
+impl TypedArenaPtr<Integer> {
+    pub fn value(&self) -> Integer {
+        unsafe { self.0.as_ref().clone() }
+    }
+}
+
 impl<T: ?Sized + PartialOrd> PartialOrd for TypedArenaPtr<T> {
     fn partial_cmp(&self, other: &Self) -> Option<std::cmp::Ordering> {
         (**self).partial_cmp(&**other)