Skip to content

Commit

Permalink
perf(heap/core::fmt::Display): 为heap实现Display (#23)
Browse files Browse the repository at this point in the history
  • Loading branch information
donjuanplatinum authored Jun 26, 2024
1 parent ebee884 commit 5fa9f83
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/structure/heap.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use core::ops::{Deref, DerefMut};
use std::fmt::Display;

macro_rules! left_child {
($parent:ident) => {
Expand Down Expand Up @@ -74,6 +75,14 @@ where
};
}
}
impl<T> Display for Heap<T>
where
T: core::fmt::Debug,
{
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
return write!(f, "{:?}", self.items);
}
}

#[allow(dead_code)]
impl<T: PartialOrd> Heap<T> {
Expand Down

0 comments on commit 5fa9f83

Please sign in to comment.