mirror of
https://github.com/bevyengine/bevy
synced 2024-11-10 07:04:33 +00:00
Add fmt::Pointer impl for bevy_ptr::{Ptr, PtrMut, OwnedPtr} (#6980)
# Objective - `bevy_ptr::{Ptr, PtrMut, OwnedPtr}` wrap raw pointers and should be printable using pointer formatting. ## Solution - Add a `core::fmt::Pointer` impl for `Ptr`, `PtrMut` and `OwnedPtr` based on the wrapped `NonNull` pointer. --- ## Changelog - Added a `core::fmt::Pointer` impl to `Ptr`, `PtrMut` and `OwnedPtr`. Co-authored-by: MrGunflame <mrgunflame@protonmail.com>
This commit is contained in:
parent
8545580214
commit
c38659ddea
1 changed files with 8 additions and 0 deletions
|
@ -2,6 +2,7 @@
|
|||
#![no_std]
|
||||
#![warn(missing_docs)]
|
||||
|
||||
use core::fmt::{self, Formatter, Pointer};
|
||||
use core::{
|
||||
cell::UnsafeCell, marker::PhantomData, mem::ManuallyDrop, num::NonZeroUsize, ptr::NonNull,
|
||||
};
|
||||
|
@ -94,6 +95,13 @@ macro_rules! impl_ptr {
|
|||
Self(inner, PhantomData)
|
||||
}
|
||||
}
|
||||
|
||||
impl Pointer for $ptr<'_> {
|
||||
#[inline]
|
||||
fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
|
||||
Pointer::fmt(&self.0, f)
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue