proper copy and clone for sendptr
This commit is contained in:
parent
46504f64f2
commit
e590dc4509
|
@ -31,9 +31,17 @@ mod util {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[repr(transparent)]
|
#[repr(transparent)]
|
||||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord)]
|
#[derive(Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
|
||||||
pub struct SendPtr<T>(NonNull<T>);
|
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> {
|
impl<T> std::fmt::Pointer for SendPtr<T> {
|
||||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||||
<NonNull<T> as core::fmt::Pointer>::fmt(&self.0, f)
|
<NonNull<T> as core::fmt::Pointer>::fmt(&self.0, f)
|
||||||
|
|
Loading…
Reference in a new issue