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 Debug for String
impl Debug for ()
impl<T> Debug for [T] where T: Debug
impl<T11> Debug for (T11,) where T11: Debug
impl<T10, T11> Debug for (T10, T11) where T10: Debug, T11: Debug
impl<T9, T10, T11> Debug for (T9, T10, T11) where T10: Debug, T9: Debug, T11: Debug
impl<T8, T9, T10, T11> Debug for (T8, T9, T10, T11) where T8: Debug, T10: Debug, T9: Debug, T11: Debug
impl<T7, T8, T9, T10, T11> Debug for (T7, T8, T9, T10, T11) where T11: Debug, T8: Debug, T9: Debug, T10: Debug, T7: Debug
impl<T6, T7, T8, T9, T10, T11> Debug for (T6, T7, T8, T9, T10, T11) where T10: Debug, T7: Debug, T11: Debug, T8: Debug, T6: Debug, T9: Debug
impl<T5, T6, T7, T8, T9, T10, T11> Debug for (T5, T6, T7, T8, T9, T10, T11) where T8: Debug, T11: Debug, T10: Debug, T7: Debug, T6: Debug, T9: Debug, T5: Debug
impl<T4, T5, T6, T7, T8, T9, T10, T11> Debug for (T4, T5, T6, T7, T8, T9, T10, T11) where T4: Debug, T5: Debug, T7: Debug, T11: Debug, T8: Debug, T9: Debug, T10: Debug, T6: Debug
impl<T3, T4, T5, T6, T7, T8, T9, T10, T11> Debug for (T3, T4, T5, T6, T7, T8, T9, T10, T11) where T4: Debug, T11: Debug, T5: Debug, T6: Debug, T7: Debug, T3: Debug, T8: Debug, T10: Debug, T9: Debug
impl<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> Debug for (T2, T3, T4, T5, T6, T7, T8, T9, T10, T11) where T4: Debug, T6: Debug, T10: Debug, T5: Debug, T9: Debug, T7: Debug, T3: Debug, T8: Debug, T2: Debug, T11: Debug
impl<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 T5: Debug, T1: Debug, T2: Debug, T11: Debug, T8: Debug, T4: Debug, T3: Debug, T6: Debug, T9: Debug, T7: Debug, T10: Debug
impl<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 T0: Debug, T7: Debug, T9: Debug, T8: Debug, T11: Debug, T6: Debug, T4: Debug, T5: Debug, T3: Debug, T2: Debug, T10: Debug, T1: Debug
impl<T> Debug for *mut T
impl<T> Debug for *const T
impl Debug for f64
impl Debug for f32
impl Debug for char
impl Debug for str
impl Debug for bool
impl Debug for u64
impl Debug for i64
impl Debug for u32
impl Debug for i32
impl Debug for u16
impl Debug for i16
impl Debug for u8
impl Debug for i8
impl Debug for usize
impl Debug for isize
impl<T, E> Debug for Result<T, E> where T: Debug, E: Debug
impl<T> Debug for [T; 32] where T: Debug
impl<T> Debug for [T; 31] where T: Debug
impl<T> Debug for [T; 30] where T: Debug
impl<T> Debug for [T; 29] where T: Debug
impl<T> Debug for [T; 28] where T: Debug
impl<T> Debug for [T; 27] where T: Debug
impl<T> Debug for [T; 26] where T: Debug
impl<T> Debug for [T; 25] where T: Debug
impl<T> Debug for [T; 24] where T: Debug
impl<T> Debug for [T; 23] where T: Debug
impl<T> Debug for [T; 22] where T: Debug
impl<T> Debug for [T; 21] where T: Debug
impl<T> Debug for [T; 20] where T: Debug
impl<T> Debug for [T; 19] where T: Debug
impl<T> Debug for [T; 18] where T: Debug
impl<T> Debug for [T; 17] where T: Debug
impl<T> Debug for [T; 16] where T: Debug
impl<T> Debug for [T; 15] where T: Debug
impl<T> Debug for [T; 14] where T: Debug
impl<T> Debug for [T; 13] where T: Debug
impl<T> Debug for [T; 12] where T: Debug
impl<T> Debug for [T; 11] where T: Debug
impl<T> Debug for [T; 10] where T: Debug
impl<T> Debug for [T; 9] where T: Debug
impl<T> Debug for [T; 8] where T: Debug
impl<T> Debug for [T; 7] where T: Debug
impl<T> Debug for [T; 6] where T: Debug
impl<T> Debug for [T; 5] where T: Debug
impl<T> Debug for [T; 4] where T: Debug
impl<T> Debug for [T; 3] where T: Debug
impl<T> Debug for [T; 2] where T: Debug
impl<T> Debug for [T; 1] where T: Debug
impl<T> Debug for [T; 0] where T: Debug
impl<T> Debug for Option<T> where T: Debug
impl<T> Debug for Vec<T> where T: Debug
impl<T> Debug for Wrapping<T> where T: Debug
impl Debug for ParseIntError
impl Debug for FpCategory
impl Debug for Thread
impl<T> Debug for BTreeSet<T> where T: Debug
impl<T> Debug for VecDeque<T> where T: Debug
impl<T> Debug for BinaryHeap<T> where T: Ord + Debug
impl<T> Debug for Bound<T> where T: Debug
impl<K, V> Debug for BTreeMap<K, V> where K: Debug, V: Debug
impl<A> Debug for LinkedList<A> where A: Debug
impl<T> Debug for Arc<T> where T: Debug + ?Sized
impl<T> Debug for Weak<T> where T: Debug + ?Sized
impl Debug for AtomicBool
impl Debug for AtomicIsize
impl Debug for AtomicUsize
impl<T> Debug for AtomicPtr<T>
impl Debug for Ordering
impl<T> Debug for Cell<T> where T: Copy + Debug
impl<T> Debug for RefCell<T> where T: Debug + ?Sized
impl Debug for BorrowState
impl<'b, T> Debug for Ref<'b, T> where T: Debug + ?Sized
impl<'b, T> Debug for RefMut<'b, T> where T: Debug + ?Sized
impl<T> Debug for UnsafeCell<T> where T: Debug + ?Sized
impl Debug for TypeId
impl<T> Debug for PhantomData<T> where T: ?Sized
impl<T> Debug for Rev<T> where T: Debug
impl<I> Debug for Cloned<I> where I: Debug
impl<I> Debug for Cycle<I> where I: Debug
impl<A, B> Debug for Chain<A, B> where B: Debug, A: Debug
impl<A, B> Debug for Zip<A, B> where B: Debug, A: Debug
impl<I, F> Debug for Map<I, F> where I: Debug
impl<I, P> Debug for Filter<I, P> where I: Debug
impl<I, F> Debug for FilterMap<I, F> where I: Debug
impl<I> Debug for Enumerate<I> where I: Debug
impl<I> Debug for Peekable<I> where I: Iterator + Debug, I::Item: Debug
impl<I, P> Debug for SkipWhile<I, P> where I: Debug
impl<I, P> Debug for TakeWhile<I, P> where I: Debug
impl<I> Debug for Skip<I> where I: Debug
impl<I> Debug for Take<I> where I: Debug
impl<I, St, F> Debug for Scan<I, St, F> where St: Debug, I: Debug
impl<I, U, F> Debug for FlatMap<I, U, F> where I: Debug, U: IntoIterator, U::IntoIter: Debug
impl<I> Debug for Fuse<I> where I: Debug
impl<I, F> Debug for Inspect<I, F> where I: Debug
impl<A, R> Debug for StepBy<A, R> where R: Debug, A: Debug
impl<A> Debug for Repeat<A> where A: Debug
impl<T> Debug for Empty<T>
impl<T> Debug for Once<T> where T: Debug
impl Debug for RangeFull
impl<Idx> Debug for Range<Idx> where Idx: Debug
impl<Idx> Debug for RangeFrom<Idx> where Idx: Debug
impl<Idx> Debug for RangeTo<Idx> where Idx: Debug
impl<Idx> Debug for RangeInclusive<Idx> where Idx: Debug
impl<Idx> Debug for RangeToInclusive<Idx> where Idx: Debug
impl<T> Debug for Rc<T> where T: Debug + ?Sized
impl<T> Debug for Weak<T> where T: Debug + ?Sized
impl Debug for FromUtf8Error
impl Debug for FromUtf16Error
impl Debug for ParseError
impl<'a, B> Debug for Cow<'a, B> where B: Debug + ToOwned + ?Sized, B::Owned: Debug
impl<'a, T> Debug for Iter<'a, T> where T: 'a + Debug
impl<'a, T> Debug for IterMut<'a, T> where T: 'a + Debug
impl<T> Debug for IntoIter<T> where T: Debug
impl Debug for Ordering
impl<H> Debug for BuildHasherDefault<H>
impl Debug for SipHasher
impl<'a, T, P> Debug for SplitMut<'a, T, P> where T: 'a + Debug, P: FnMut(&T) -> bool
impl<'a, T, P> Debug for SplitNMut<'a, T, P> where P: FnMut(&T) -> bool, T: 'a + Debug
impl<'a, T, P> Debug for RSplitN<'a, T, P> where T: 'a + Debug, P: FnMut(&T) -> bool
impl<'a, T, P> Debug for SplitN<'a, T, P> where T: 'a + Debug, P: FnMut(&T) -> bool
impl<'a, T, P> Debug for Split<'a, T, P> where T: 'a + Debug, P: FnMut(&T) -> bool
impl<'a, T> Debug for Chunks<'a, T> where T: 'a + Debug
impl<'a, T, P> Debug for RSplitNMut<'a, T, P> where T: 'a + Debug, P: FnMut(&T) -> bool
impl<'a, T> Debug for Iter<'a, T> where T: 'a + Debug
impl<'a, T> Debug for IterMut<'a, T> where T: 'a + Debug
impl<'a, T> Debug for ChunksMut<'a, T> where T: 'a + Debug
impl<'a, T> Debug for Windows<'a, T> where T: 'a + Debug
impl<'a, A> Debug for Iter<'a, A> where A: 'a + Debug
impl<'a, A> Debug for IterMut<'a, A> where A: 'a + Debug
impl<A> Debug for IntoIter<A> where A: Debug
impl Debug for Error
impl<'a> Debug for Arguments<'a>
impl<'a, P> Debug for SplitN<'a, P> where P: Pattern<'a>, P::Searcher: Debug
impl<'a, P> Debug for RMatches<'a, P> where P: Pattern<'a>, P::Searcher: Debug
impl<'a> Debug for Bytes<'a>
impl<'a, P> Debug for MatchIndices<'a, P> where P: Pattern<'a>, P::Searcher: Debug
impl<'a> Debug for Chars<'a>
impl<'a, P> Debug for Split<'a, P> where P: Pattern<'a>, P::Searcher: Debug
impl<'a, P> Debug for RSplitTerminator<'a, P> where P: Pattern<'a>, P::Searcher: Debug
impl<'a> Debug for LinesAny<'a>
impl<'a, P> Debug for RMatchIndices<'a, P> where P: Pattern<'a>, P::Searcher: Debug
impl Debug for CharRange
impl<'a, P> Debug for Matches<'a, P> where P: Pattern<'a>, P::Searcher: Debug
impl<'a, P> Debug for RSplit<'a, P> where P: Pattern<'a>, P::Searcher: Debug
impl Debug for Utf8Error
impl<'a, P> Debug for RSplitN<'a, P> where P: Pattern<'a>, P::Searcher: Debug
impl Debug for ParseBoolError
impl<'a, P> Debug for SplitTerminator<'a, P> where P: Pattern<'a>, P::Searcher: Debug
impl<'a> Debug for CharIndices<'a>
impl<'a> Debug for Lines<'a>
impl Debug for EncodeUtf8
impl Debug for EscapeDefault
impl Debug for EscapeUnicode
impl Debug for EncodeUtf16
impl Debug for EglCallError
impl Debug for Error
impl Debug for FrameBufferConfigRef
impl Debug for Version
impl Debug for Type
impl Debug for Type
impl Debug for ColorBufferType
impl Debug for ConfigCaveat
impl Debug for TransparentType