Skip to content

Commit

Permalink
Merge pull request #42 from bastion-rs/debug-impl-with-thunk-ptr
Browse files Browse the repository at this point in the history
Debug impl with thunk pointer
  • Loading branch information
vertexclique authored Oct 6, 2019
2 parents e4e850c + 3837a25 commit 11bfafd
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
11 changes: 5 additions & 6 deletions src/child.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,11 @@ impl PartialEq for BastionChildren {

impl Debug for BastionChildren {
fn fmt(&self, f: &mut Formatter) -> Result<(), fmt::Error> {
// TODO: add thunk ref address here
write!(
f,
"(ID :: {:?}, Redundancy :: {:?})",
self.id, self.redundancy
)
f.debug_struct("BastionChildren")
.field("id", &self.id)
.field("redundancy", &self.redundancy)
.field("thunk_ptr", &format_args!("{:p}", &self.thunk as *const _))
.finish()
}
}

Expand Down
12 changes: 7 additions & 5 deletions src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -265,10 +265,12 @@ impl BastionContext {

impl Debug for BastionContext {
fn fmt(&self, f: &mut Formatter) -> Result<(), fmt::Error> {
write!(
f,
"\nContext\n\tParent :: {:?}, Descendants :: {:?}, Killed :: {:?}, TX :: {:?}, RX :: {:?}\n\t",
self.parent, self.descendants, self.killed, self.bcast_tx, self.bcast_rx
)
f.debug_struct("BastionContext")
.field("parent", &self.parent)
.field("descendants", &self.descendants)
.field("killed", &self.killed)
.field("TX", &self.bcast_tx)
.field("RX", &self.bcast_rx)
.finish()
}
}

0 comments on commit 11bfafd

Please sign in to comment.