proper copy and clone for sendptr

This commit is contained in:
Janis 2025-06-17 14:45:22 +02:00
parent 46504f64f2
commit e590dc4509

View file

@ -31,9 +31,17 @@ mod util {
}
#[repr(transparent)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord)]
#[derive(Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct SendPtr<T>(NonNull<T>);
impl<T> Copy for SendPtr<T> {}
impl<T> Clone for SendPtr<T> {
fn clone(&self) -> Self {
Self(self.0.clone())
}
}
impl<T> std::fmt::Pointer for SendPtr<T> {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
<NonNull<T> as core::fmt::Pointer>::fmt(&self.0, f)