add Debug

This commit is contained in:
numzero 2026-05-07 22:03:32 +03:00
parent 57de8c826d
commit 419e5b59b9

View File

@ -1,5 +1,6 @@
use std::{ use std::{
any::Any, any::Any,
fmt::Debug,
marker::PhantomData, marker::PhantomData,
mem::ManuallyDrop, mem::ManuallyDrop,
ops::{Deref, DerefMut}, ops::{Deref, DerefMut},
@ -32,6 +33,12 @@ impl<T: ?Sized> DerefMut for OwnRef<'_, T> {
} }
} }
impl<T: Debug + ?Sized> Debug for OwnRef<'_, T> {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.debug_tuple("OwnRef").field(&&**self).finish()
}
}
impl<T: ?Sized> OwnRef<'_, T> { impl<T: ?Sized> OwnRef<'_, T> {
pub unsafe fn new_unchecked(p: NonNull<T>) -> Self { pub unsafe fn new_unchecked(p: NonNull<T>) -> Self {
Self(Some(p), PhantomData) Self(Some(p), PhantomData)