mirror of
https://github.com/gfx-rs/wgpu.git
synced 2024-11-30 02:33:38 +00:00
Implement Debug for arena and handle
This commit is contained in:
parent
26e6c2bdac
commit
f03a99d6a3
@ -45,7 +45,7 @@ impl<T> Ord for Handle<T> {
|
||||
}
|
||||
impl<T> fmt::Debug for Handle<T> {
|
||||
fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
|
||||
write!(formatter, "Handle({})", self.index)
|
||||
write!(formatter, "[{}]", self.index)
|
||||
}
|
||||
}
|
||||
impl<T> hash::Hash for Handle<T> {
|
||||
@ -81,7 +81,6 @@ impl<T> Handle<T> {
|
||||
/// Adding new items to the arena produces a strongly-typed [`Handle`].
|
||||
/// The arena can be indexed using the given handle to obtain
|
||||
/// a reference to the stored item.
|
||||
#[derive(Debug)]
|
||||
#[cfg_attr(feature = "serialize", derive(serde::Serialize))]
|
||||
#[cfg_attr(feature = "deserialize", derive(serde::Deserialize))]
|
||||
#[cfg_attr(
|
||||
@ -99,6 +98,11 @@ impl<T> Default for Arena<T> {
|
||||
Self::new()
|
||||
}
|
||||
}
|
||||
impl<T: fmt::Debug> fmt::Debug for Arena<T> {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
f.debug_map().entries(self.iter()).finish()
|
||||
}
|
||||
}
|
||||
|
||||
impl<T> Arena<T> {
|
||||
/// Create a new arena with no initial capacity allocated.
|
||||
|
Loading…
Reference in New Issue
Block a user