diff --git a/cmd/zfs_object_agent/util/src/cffi.rs b/cmd/zfs_object_agent/util/src/cffi.rs index 1c6c32903898..9868224dfc29 100644 --- a/cmd/zfs_object_agent/util/src/cffi.rs +++ b/cmd/zfs_object_agent/util/src/cffi.rs @@ -8,6 +8,9 @@ //! was written out, see block_encode.rs. use std::any::type_name; +use std::fmt; +use std::fmt::Debug; +use std::fmt::Formatter; use std::mem::align_of; use std::mem::size_of; use std::ops::Deref; @@ -116,12 +119,23 @@ pub fn bytes_to_slice(bytes: Bytes) -> Result> { } } -#[derive(Debug)] pub enum Slice { Referenced(Bytes), Owned(Vec), } +impl Debug for Slice { + fn fmt(&self, f: &mut Formatter) -> fmt::Result { + match self { + Slice::Referenced(_) => f + .debug_tuple("Slice::Referenced") + .field(&self.deref()) + .finish(), + Slice::Owned(_) => f.debug_tuple("Slice::Owned").field(&self.deref()).finish(), + } + } +} + impl Slice { pub fn new_owned(vec: Vec) -> Self { Slice::Owned(vec)