@@ -543,27 +543,31 @@ impl<'a, 'b: 'a> DebugMap<'a, 'b> {
543
543
/// This is useful you need to use the `Display` `impl` of a type in a `Debug`
544
544
/// context instead of the `Debug` `impl` of the type. One such scenario where
545
545
/// this is useful is when you need an unquoted string as part of your
546
- /// [`Debug::fmt`](trait.Debug.html#tymethod.fmt) implementation.
546
+ /// [`Debug::fmt`](trait.Debug.html#tymethod.fmt) implementation. As seen
547
+ /// below in the example, this can happen when you want to use [`.debug_set()`]
548
+ /// methods and friends.
549
+ ///
550
+ /// [`.debug_set()`]: struct.Formatter.html#method.debug_set
547
551
///
548
- /// The difference between `&'a str` and `DebugDisplay <&'a str>` in a `Debug`
552
+ /// The difference between `&'a str` and `DisplayAsDebug <&'a str>` in a `Debug`
549
553
/// context such as `println!("{:?}", <value>)` is that the former will quote
550
554
/// the string while the latter will not. In other words, the following holds:
551
555
///
552
556
/// ```rust
553
- /// #![feature(debug_display )]
554
- /// use std::fmt::DebugDisplay ;
557
+ /// #![feature(display_as_debug )]
558
+ /// use std::fmt::DisplayAsDebug ;
555
559
///
556
- /// assert_eq!("foo", format!("{:?}", DebugDisplay ("foo")));
560
+ /// assert_eq!("foo", format!("{:?}", DisplayAsDebug ("foo")));
557
561
/// assert_eq!("\"foo\"", format!("{:?}", "foo"));
558
562
/// ```
559
563
///
560
564
/// # Examples
561
565
///
562
- /// In this example we use `DebugDisplay ("_")` for a "catch all" match arm.
566
+ /// In this example we use `DisplayAsDebug ("_")` for a "catch all" match arm.
563
567
///
564
568
/// ```rust
565
- /// #![feature(debug_display )]
566
- /// use std::fmt::{Debug, Formatter, DebugDisplay , Result};
569
+ /// #![feature(display_as_debug )]
570
+ /// use std::fmt::{Debug, Formatter, DisplayAsDebug , Result};
567
571
///
568
572
/// struct Arm<'a, L: 'a, R: 'a>(&'a (L, R));
569
573
/// struct Table<'a, K: 'a, V: 'a>(&'a [(K, V)], V);
@@ -580,7 +584,7 @@ impl<'a, 'b: 'a> DebugMap<'a, 'b> {
580
584
/// fn fmt(&self, fmt: &mut Formatter) -> Result {
581
585
/// fmt.debug_set()
582
586
/// .entries(self.0.iter().map(Arm))
583
- /// .entry(&Arm(&(DebugDisplay ("_"), &self.1)))
587
+ /// .entry(&Arm(&(DisplayAsDebug ("_"), &self.1)))
584
588
/// .finish()
585
589
/// }
586
590
/// }
@@ -589,13 +593,13 @@ impl<'a, 'b: 'a> DebugMap<'a, 'b> {
589
593
/// assert_eq!(format!("{:?}", Table(&*table, 0)),
590
594
/// "{0 => 1, 1 => 2, _ => 0}");
591
595
/// ```
592
- #[ unstable( feature = "debug_display " , issue = "0" ) ]
596
+ #[ unstable( feature = "display_as_debug " , issue = "0" ) ]
593
597
#[ must_use]
594
598
#[ derive( Copy , Clone ) ]
595
- pub struct DebugDisplay < T > ( pub T ) ;
599
+ pub struct DisplayAsDebug < T > ( pub T ) ;
596
600
597
- #[ unstable( feature = "debug_display " , issue = "0" ) ]
598
- impl < T : fmt:: Display > fmt:: Debug for DebugDisplay < T > {
601
+ #[ unstable( feature = "display_as_debug " , issue = "0" ) ]
602
+ impl < T : fmt:: Display > fmt:: Debug for DisplayAsDebug < T > {
599
603
fn fmt ( & self , fmt : & mut fmt:: Formatter ) -> fmt:: Result {
600
604
<T as fmt:: Display >:: fmt ( & self . 0 , fmt)
601
605
}
0 commit comments