diff options
| author | Glenn Smith <glenn@vector35.com> | 2022-06-29 17:28:31 -0400 |
|---|---|---|
| committer | Glenn Smith <glenn@vector35.com> | 2022-09-29 21:02:20 -0400 |
| commit | 642d32f688d735decccf2b844d113c436982f5e0 (patch) | |
| tree | 0148b8474bd154345c121c623b2fa23159e0c755 /rust/src/rc.rs | |
| parent | 207925956bb8ca0174d40523fda70bfb5bc7bd38 (diff) | |
[Rust API] Make more types convertible to BN types
Diffstat (limited to 'rust/src/rc.rs')
| -rw-r--r-- | rust/src/rc.rs | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/rust/src/rc.rs b/rust/src/rc.rs index f8507d0c..b21b7b94 100644 --- a/rust/src/rc.rs +++ b/rust/src/rc.rs @@ -15,6 +15,7 @@ //! Reference counting for core Binary Ninja objects. use std::borrow::Borrow; +use std::fmt::{Debug, Display, Formatter}; use std::marker::PhantomData; use std::mem; use std::ops::{Deref, DerefMut}; @@ -99,6 +100,18 @@ impl<T: RefCountable> Clone for Ref<T> { } } +impl<T: RefCountable + Display> Display for Ref<T> { + fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { + self.contents.fmt(f) + } +} + +impl<T: RefCountable + Debug> Debug for Ref<T> { + fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { + self.contents.fmt(f) + } +} + // Guard provides access to a core-allocated resource whose // reference is held indirectly (e.g. a core-allocated array // of raw `*mut BNRawT`). |
