mirror of
https://github.com/bevyengine/bevy
synced 2024-11-21 20:23:28 +00:00
add Debug for ptr types (#13498)
# Objective - I wanted to store a Ptr in a struct of mine that has a `#[derive(Debug)]` and I noticed that the Ptrs don't implement Debug, even though the underlying `NonNull<u8>` does ## Solution - Add `#[derive(Debug)]`
This commit is contained in:
parent
44c0325ecd
commit
b2b356f462
1 changed files with 3 additions and 1 deletions
|
@ -155,7 +155,7 @@ impl<'a, T: ?Sized> From<&'a mut T> for ConstNonNull<T> {
|
|||
///
|
||||
/// It may be helpful to think of this type as similar to `&'a dyn Any` but without
|
||||
/// the metadata and able to point to data that does not correspond to a Rust type.
|
||||
#[derive(Copy, Clone)]
|
||||
#[derive(Copy, Clone, Debug)]
|
||||
#[repr(transparent)]
|
||||
pub struct Ptr<'a, A: IsAligned = Aligned>(NonNull<u8>, PhantomData<(&'a u8, A)>);
|
||||
|
||||
|
@ -170,6 +170,7 @@ pub struct Ptr<'a, A: IsAligned = Aligned>(NonNull<u8>, PhantomData<(&'a u8, A)>
|
|||
///
|
||||
/// It may be helpful to think of this type as similar to `&'a mut dyn Any` but without
|
||||
/// the metadata and able to point to data that does not correspond to a Rust type.
|
||||
#[derive(Debug)]
|
||||
#[repr(transparent)]
|
||||
pub struct PtrMut<'a, A: IsAligned = Aligned>(NonNull<u8>, PhantomData<(&'a mut u8, A)>);
|
||||
|
||||
|
@ -188,6 +189,7 @@ pub struct PtrMut<'a, A: IsAligned = Aligned>(NonNull<u8>, PhantomData<(&'a mut
|
|||
///
|
||||
/// It may be helpful to think of this type as similar to `&'a mut ManuallyDrop<dyn Any>` but
|
||||
/// without the metadata and able to point to data that does not correspond to a Rust type.
|
||||
#[derive(Debug)]
|
||||
#[repr(transparent)]
|
||||
pub struct OwningPtr<'a, A: IsAligned = Aligned>(NonNull<u8>, PhantomData<(&'a mut u8, A)>);
|
||||
|
||||
|
|
Loading…
Reference in a new issue