Trait bitflags::__core::fmt::Debug
[−]
[src]
pub trait Debug {
fn fmt(&self, &mut Formatter) -> Result<(), Error>;
}Format trait for the ? character.
Debug should format the output in a programmer-facing, debugging context.
Generally speaking, you should just derive a Debug implementation.
When used with the alternate format specifier #?, the output is pretty-printed.
For more information on formatters, see the module-level documentation.
This trait can be used with #[derive].
Examples
Deriving an implementation:
#[derive(Debug)] struct Point { x: i32, y: i32, } let origin = Point { x: 0, y: 0 }; println!("The origin is: {:?}", origin);
Manually implementing:
use std::fmt; struct Point { x: i32, y: i32, } impl fmt::Debug for Point { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "Point {{ x: {}, y: {} }}", self.x, self.y) } } let origin = Point { x: 0, y: 0 }; println!("The origin is: {:?}", origin);
This outputs:
The origin is: Point { x: 0, y: 0 }
There are a number of debug_* methods on Formatter to help you with manual
implementations, such as debug_struct.
Debug implementations using either derive or the debug builder API
on Formatter support pretty printing using the alternate flag: {:#?}.
Pretty printing with #?:
#[derive(Debug)] struct Point { x: i32, y: i32, } let origin = Point { x: 0, y: 0 }; println!("The origin is: {:#?}", origin);
This outputs:
The origin is: Point {
x: 0,
y: 0
}
Required Methods
Implementors
impl<T> Debug for Box<T> where T: Debug + ?Sizedimpl<T> Debug for Weak<T> where T: Debug + ?Sizedimpl<T> Debug for Arc<T> where T: Debug + ?Sizedimpl<T> Debug for Rc<T> where T: Debug + ?Sizedimpl<T> Debug for Weak<T> where T: Debug + ?Sizedimpl<T> Debug for Wrapping<T> where T: Debugimpl Debug for FpCategoryimpl Debug for ParseIntErrorimpl Debug for IntErrorKindimpl<T> Debug for NonZero<T> where T: Zeroable + Debugimpl<Ret> Debug for fn() -> Retimpl<Ret> Debug for extern "C" fn() -> Retimpl<Ret> Debug for unsafe fn() -> Retimpl<Ret> Debug for unsafe extern "C" fn() -> Retimpl<Ret, A> Debug for fn(A) -> Retimpl<Ret, A> Debug for extern "C" fn(A) -> Retimpl<Ret, A> Debug for unsafe fn(A) -> Retimpl<Ret, A> Debug for unsafe extern "C" fn(A) -> Retimpl<Ret, A, B> Debug for fn(A, B) -> Retimpl<Ret, A, B> Debug for extern "C" fn(A, B) -> Retimpl<Ret, A, B> Debug for unsafe fn(A, B) -> Retimpl<Ret, A, B> Debug for unsafe extern "C" fn(A, B) -> Retimpl<Ret, A, B, C> Debug for fn(A, B, C) -> Retimpl<Ret, A, B, C> Debug for extern "C" fn(A, B, C) -> Retimpl<Ret, A, B, C> Debug for unsafe fn(A, B, C) -> Retimpl<Ret, A, B, C> Debug for unsafe extern "C" fn(A, B, C) -> Retimpl<Ret, A, B, C, D> Debug for fn(A, B, C, D) -> Retimpl<Ret, A, B, C, D> Debug for extern "C" fn(A, B, C, D) -> Retimpl<Ret, A, B, C, D> Debug for unsafe fn(A, B, C, D) -> Retimpl<Ret, A, B, C, D> Debug for unsafe extern "C" fn(A, B, C, D) -> Retimpl<Ret, A, B, C, D, E> Debug for fn(A, B, C, D, E) -> Retimpl<Ret, A, B, C, D, E> Debug for extern "C" fn(A, B, C, D, E) -> Retimpl<Ret, A, B, C, D, E> Debug for unsafe fn(A, B, C, D, E) -> Retimpl<Ret, A, B, C, D, E> Debug for unsafe extern "C" fn(A, B, C, D, E) -> Retimpl<Ret, A, B, C, D, E, F> Debug for fn(A, B, C, D, E, F) -> Retimpl<Ret, A, B, C, D, E, F> Debug for extern "C" fn(A, B, C, D, E, F) -> Retimpl<Ret, A, B, C, D, E, F> Debug for unsafe fn(A, B, C, D, E, F) -> Retimpl<Ret, A, B, C, D, E, F> Debug for unsafe extern "C" fn(A, B, C, D, E, F) -> Retimpl<Ret, A, B, C, D, E, F, G> Debug for fn(A, B, C, D, E, F, G) -> Retimpl<Ret, A, B, C, D, E, F, G> Debug for extern "C" fn(A, B, C, D, E, F, G) -> Retimpl<Ret, A, B, C, D, E, F, G> Debug for unsafe fn(A, B, C, D, E, F, G) -> Retimpl<Ret, A, B, C, D, E, F, G> Debug for unsafe extern "C" fn(A, B, C, D, E, F, G) -> Retimpl<Ret, A, B, C, D, E, F, G, H> Debug for fn(A, B, C, D, E, F, G, H) -> Retimpl<Ret, A, B, C, D, E, F, G, H> Debug for extern "C" fn(A, B, C, D, E, F, G, H) -> Retimpl<Ret, A, B, C, D, E, F, G, H> Debug for unsafe fn(A, B, C, D, E, F, G, H) -> Retimpl<Ret, A, B, C, D, E, F, G, H> Debug for unsafe extern "C" fn(A, B, C, D, E, F, G, H) -> Retimpl<Ret, A, B, C, D, E, F, G, H, I> Debug for fn(A, B, C, D, E, F, G, H, I) -> Retimpl<Ret, A, B, C, D, E, F, G, H, I> Debug for extern "C" fn(A, B, C, D, E, F, G, H, I) -> Retimpl<Ret, A, B, C, D, E, F, G, H, I> Debug for unsafe fn(A, B, C, D, E, F, G, H, I) -> Retimpl<Ret, A, B, C, D, E, F, G, H, I> Debug for unsafe extern "C" fn(A, B, C, D, E, F, G, H, I) -> Retimpl<Ret, A, B, C, D, E, F, G, H, I, J> Debug for fn(A, B, C, D, E, F, G, H, I, J) -> Retimpl<Ret, A, B, C, D, E, F, G, H, I, J> Debug for extern "C" fn(A, B, C, D, E, F, G, H, I, J) -> Retimpl<Ret, A, B, C, D, E, F, G, H, I, J> Debug for unsafe fn(A, B, C, D, E, F, G, H, I, J) -> Retimpl<Ret, A, B, C, D, E, F, G, H, I, J> Debug for unsafe extern "C" fn(A, B, C, D, E, F, G, H, I, J) -> Retimpl<Ret, A, B, C, D, E, F, G, H, I, J, K> Debug for fn(A, B, C, D, E, F, G, H, I, J, K) -> Retimpl<Ret, A, B, C, D, E, F, G, H, I, J, K> Debug for extern "C" fn(A, B, C, D, E, F, G, H, I, J, K) -> Retimpl<Ret, A, B, C, D, E, F, G, H, I, J, K> Debug for unsafe fn(A, B, C, D, E, F, G, H, I, J, K) -> Retimpl<Ret, A, B, C, D, E, F, G, H, I, J, K> Debug for unsafe extern "C" fn(A, B, C, D, E, F, G, H, I, J, K) -> Retimpl<Ret, A, B, C, D, E, F, G, H, I, J, K, L> Debug for fn(A, B, C, D, E, F, G, H, I, J, K, L) -> Retimpl<Ret, A, B, C, D, E, F, G, H, I, J, K, L> Debug for extern "C" fn(A, B, C, D, E, F, G, H, I, J, K, L) -> Retimpl<Ret, A, B, C, D, E, F, G, H, I, J, K, L> Debug for unsafe fn(A, B, C, D, E, F, G, H, I, J, K, L) -> Retimpl<Ret, A, B, C, D, E, F, G, H, I, J, K, L> Debug for unsafe extern "C" fn(A, B, C, D, E, F, G, H, I, J, K, L) -> Retimpl Debug for RangeFullimpl<Idx> Debug for Range<Idx> where Idx: Debugimpl<Idx> Debug for RangeFrom<Idx> where Idx: Debugimpl<Idx> Debug for RangeTo<Idx> where Idx: Debugimpl Debug for Orderingimpl Debug for Any + 'staticimpl Debug for Any + 'static + Sendimpl Debug for TypeIdimpl<T> Debug for [T; 0] where T: Debugimpl<T> Debug for [T; 1] where T: Debugimpl<T> Debug for [T; 2] where T: Debugimpl<T> Debug for [T; 3] where T: Debugimpl<T> Debug for [T; 4] where T: Debugimpl<T> Debug for [T; 5] where T: Debugimpl<T> Debug for [T; 6] where T: Debugimpl<T> Debug for [T; 7] where T: Debugimpl<T> Debug for [T; 8] where T: Debugimpl<T> Debug for [T; 9] where T: Debugimpl<T> Debug for [T; 10] where T: Debugimpl<T> Debug for [T; 11] where T: Debugimpl<T> Debug for [T; 12] where T: Debugimpl<T> Debug for [T; 13] where T: Debugimpl<T> Debug for [T; 14] where T: Debugimpl<T> Debug for [T; 15] where T: Debugimpl<T> Debug for [T; 16] where T: Debugimpl<T> Debug for [T; 17] where T: Debugimpl<T> Debug for [T; 18] where T: Debugimpl<T> Debug for [T; 19] where T: Debugimpl<T> Debug for [T; 20] where T: Debugimpl<T> Debug for [T; 21] where T: Debugimpl<T> Debug for [T; 22] where T: Debugimpl<T> Debug for [T; 23] where T: Debugimpl<T> Debug for [T; 24] where T: Debugimpl<T> Debug for [T; 25] where T: Debugimpl<T> Debug for [T; 26] where T: Debugimpl<T> Debug for [T; 27] where T: Debugimpl<T> Debug for [T; 28] where T: Debugimpl<T> Debug for [T; 29] where T: Debugimpl<T> Debug for [T; 30] where T: Debugimpl<T> Debug for [T; 31] where T: Debugimpl<T> Debug for [T; 32] where T: Debugimpl Debug for AtomicUsizeimpl Debug for AtomicIsizeimpl Debug for AtomicBoolimpl<T> Debug for AtomicPtr<T>impl Debug for BorrowStateimpl<T> Debug for Option<T> where T: Debugimpl<T, E> Debug for Result<T, E> where E: Debug, T: Debugimpl Debug for SearchStepimpl<'a, 'b> Debug for StrSearcher<'a, 'b>impl Debug for StrSearcherImplimpl Debug for EmptyNeedleimpl Debug for TwoWaySearcherimpl Debug for ParseBoolErrorimpl Debug for Utf8Errorimpl Debug for RadixFmt<isize, Radix>impl Debug for isizeimpl Debug for RadixFmt<usize, Radix>impl Debug for usizeimpl Debug for RadixFmt<i8, Radix>impl Debug for i8impl Debug for RadixFmt<u8, Radix>impl Debug for u8impl Debug for RadixFmt<i16, Radix>impl Debug for i16impl Debug for RadixFmt<u16, Radix>impl Debug for u16impl Debug for RadixFmt<i32, Radix>impl Debug for i32impl Debug for RadixFmt<u32, Radix>impl Debug for u32impl Debug for RadixFmt<i64, Radix>impl Debug for i64impl Debug for RadixFmt<u64, Radix>impl Debug for u64impl Debug for Errorimpl<'a> Debug for Arguments<'a>impl<'a, T> Debug for &'a T where T: Debug + ?Sizedimpl<'a, T> Debug for &'a mut T where T: Debug + ?Sizedimpl Debug for boolimpl Debug for strimpl Debug for charimpl Debug for f32impl Debug for f64impl<T> Debug for *const Timpl<T> Debug for *mut Timpl<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> Debug for (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11) where T9: Debug, T0: Debug, T3: Debug, T11: Debug, T2: Debug, T8: Debug, T6: Debug, T5: Debug, T10: Debug, T4: Debug, T1: Debug, T7: Debugimpl<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> Debug for (T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11) where T4: Debug, T10: Debug, T2: Debug, T7: Debug, T1: Debug, T11: Debug, T6: Debug, T9: Debug, T8: Debug, T3: Debug, T5: Debugimpl<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> Debug for (T2, T3, T4, T5, T6, T7, T8, T9, T10, T11) where T9: Debug, T5: Debug, T3: Debug, T10: Debug, T4: Debug, T8: Debug, T11: Debug, T2: Debug, T6: Debug, T7: Debugimpl<T3, T4, T5, T6, T7, T8, T9, T10, T11> Debug for (T3, T4, T5, T6, T7, T8, T9, T10, T11) where T9: Debug, T4: Debug, T7: Debug, T5: Debug, T6: Debug, T3: Debug, T10: Debug, T11: Debug, T8: Debugimpl<T4, T5, T6, T7, T8, T9, T10, T11> Debug for (T4, T5, T6, T7, T8, T9, T10, T11) where T8: Debug, T4: Debug, T10: Debug, T7: Debug, T6: Debug, T11: Debug, T5: Debug, T9: Debugimpl<T5, T6, T7, T8, T9, T10, T11> Debug for (T5, T6, T7, T8, T9, T10, T11) where T7: Debug, T10: Debug, T11: Debug, T8: Debug, T5: Debug, T9: Debug, T6: Debugimpl<T6, T7, T8, T9, T10, T11> Debug for (T6, T7, T8, T9, T10, T11) where T8: Debug, T9: Debug, T6: Debug, T10: Debug, T11: Debug, T7: Debugimpl<T7, T8, T9, T10, T11> Debug for (T7, T8, T9, T10, T11) where T8: Debug, T10: Debug, T11: Debug, T9: Debug, T7: Debugimpl<T8, T9, T10, T11> Debug for (T8, T9, T10, T11) where T11: Debug, T9: Debug, T10: Debug, T8: Debugimpl<T9, T10, T11> Debug for (T9, T10, T11) where T11: Debug, T9: Debug, T10: Debugimpl<T10, T11> Debug for (T10, T11) where T11: Debug, T10: Debugimpl<T11> Debug for (T11,) where T11: Debugimpl<T> Debug for [T] where T: Debugimpl Debug for ()impl<T> Debug for PhantomData<T> where T: ?Sizedimpl<T> Debug for Cell<T> where T: Copy + Debugimpl<T> Debug for RefCell<T> where T: Debug + ?Sizedimpl<'b, T> Debug for Ref<'b, T> where T: Debug + ?Sizedimpl<'b, T> Debug for RefMut<'b, T> where T: Debug + ?Sizedimpl<T> Debug for BinaryHeap<T> where T: Ord + Debugimpl<K, V> Debug for BTreeMap<K, V> where V: Debug, K: Debugimpl<T> Debug for BTreeSet<T> where T: Debugimpl<'a, B> Debug for Cow<'a, B> where B: Debug + ToOwned + ?Sized, B::Owned: Debugimpl<E> Debug for EnumSet<E> where E: CLike + Debugimpl<A> Debug for LinkedList<A> where A: Debugimpl Debug for FromUtf8Errorimpl Debug for FromUtf16Errorimpl Debug for Stringimpl Debug for ParseErrorimpl<T> Debug for Vec<T> where T: Debugimpl<T> Debug for VecDeque<T> where T: Debugimpl<T> Debug for Bound<T> where T: Debugimpl Debug for Threadimpl<K, V, S> Debug for HashMap<K, V, S> where K: Eq + Hash + Debug, S: BuildHasher, V: Debugimpl<T, S> Debug for HashSet<T, S> where S: BuildHasher, T: Eq + Hash + Debugimpl Debug for VarErrorimpl Debug for JoinPathsErrorimpl Debug for NulErrorimpl Debug for IntoStringErrorimpl Debug for CStringimpl Debug for CStrimpl Debug for OsStringimpl Debug for OsStrimpl Debug for Permissionsimpl Debug for Fileimpl<R> Debug for BufReader<R> where R: Debugimpl<W> Debug for IntoInnerError<W> where W: Debugimpl<W> Debug for BufWriter<W> where W: Write + Debugimpl<W> Debug for LineWriter<W> where W: Write + Debugimpl<T> Debug for Cursor<T> where T: Debugimpl Debug for Errorimpl Debug for Customimpl Debug for ErrorKindimpl Debug for Reprimpl Debug for SeekFromimpl Debug for CharsErrorimpl Debug for IpAddrimpl Debug for Ipv6MulticastScopeimpl Debug for Ipv4Addrimpl Debug for Ipv6Addrimpl Debug for SocketAddrimpl Debug for SocketAddrV4impl Debug for SocketAddrV6impl Debug for TcpStreamimpl Debug for TcpListenerimpl Debug for UdpSocketimpl Debug for AddrParseErrorimpl Debug for Shutdownimpl<'a> Debug for Prefix<'a>impl Debug for Stateimpl<'a> Debug for PrefixComponent<'a>impl<'a> Debug for Component<'a>impl Debug for PathBufimpl Debug for StripPrefixErrorimpl Debug for Pathimpl<'a> Debug for Display<'a>impl Debug for Commandimpl Debug for Outputimpl Debug for ExitStatusimpl Debug for Selectimpl<'rx, T> Debug for Handle<'rx, T> where T: Send + 'rximpl Debug for Failureimpl Debug for RecvErrorimpl Debug for TryRecvErrorimpl<T> Debug for Sender<T>impl<T> Debug for SyncSender<T>impl<T> Debug for Receiver<T>impl<T> Debug for SendError<T>impl<T> Debug for TrySendError<T>impl Debug for WaitTimeoutResultimpl<T> Debug for Mutex<T> where T: Debug + ?Sizedimpl<T> Debug for RwLock<T> where T: Debug + ?Sizedimpl Debug for Durationimpl Debug for SystemTimeErrorimpl Debug for Instantimpl Debug for SystemTimeimpl Debug for TcpStreamimpl Debug for TcpListenerimpl Debug for UdpSocketimpl<T> Debug for PoisonError<T>impl<T> Debug for TryLockError<T>impl<T> Debug for ReentrantMutex<T> where T: 'static + Debugimpl Debug for CodePointimpl Debug for Wtf8Bufimpl Debug for Wtf8impl Debug for FilePermissionsimpl Debug for Fileimpl Debug for JoinPathsErrorimpl Debug for Sliceimpl Debug for Bufimpl Debug for Commandimpl Debug for ExitStatusimpl Debug for Instantimpl Debug for SystemTime