mirror of
https://github.com/topjohnwu/cxx.git
synced 2025-02-19 07:38:02 +00:00
Add impl Debug for WeakPtr
This commit is contained in:
parent
bc6e43c156
commit
18ed79b04c
@ -1,7 +1,7 @@
|
||||
use crate::shared_ptr::{SharedPtr, SharedPtrTarget};
|
||||
use crate::string::CxxString;
|
||||
use core::ffi::c_void;
|
||||
use core::fmt::Display;
|
||||
use core::fmt::{self, Debug, Display};
|
||||
use core::marker::PhantomData;
|
||||
use core::mem::MaybeUninit;
|
||||
|
||||
@ -82,6 +82,15 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
impl<T> Debug for WeakPtr<T>
|
||||
where
|
||||
T: Debug + WeakPtrTarget + SharedPtrTarget,
|
||||
{
|
||||
fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
|
||||
Debug::fmt(&self.upgrade(), formatter)
|
||||
}
|
||||
}
|
||||
|
||||
// Methods are private; not intended to be implemented outside of cxxbridge
|
||||
// codebase.
|
||||
pub unsafe trait WeakPtrTarget {
|
||||
|
Loading…
x
Reference in New Issue
Block a user