Skip to content

Commit 1c7ea30

Browse files
committed
implement Default for AsciiChar
1 parent fd9bb7f commit 1c7ea30

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

library/core/src/ascii/ascii_char.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ use crate::mem::transmute;
5858
#[unstable(feature = "ascii_char", issue = "110998")]
5959
#[repr(u8)]
6060
pub enum AsciiChar {
61-
/// U+0000
61+
/// U+0000 (The default variant)
6262
#[unstable(feature = "ascii_char_variants", issue = "110998")]
6363
Null = 0,
6464
/// U+0001

library/core/src/default.rs

+3
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
33
#![stable(feature = "rust1", since = "1.0.0")]
44

5+
use crate::ascii::Char as AsciiChar;
6+
57
/// A trait for giving a type a useful default value.
68
///
79
/// Sometimes, you want to fall back to some kind of default value, and
@@ -158,6 +160,7 @@ macro_rules! default_impl {
158160
default_impl! { (), (), "Returns the default value of `()`" }
159161
default_impl! { bool, false, "Returns the default value of `false`" }
160162
default_impl! { char, '\x00', "Returns the default value of `\\x00`" }
163+
default_impl! { AsciiChar, AsciiChar::Null, "Returns the default value of `Null`" }
161164

162165
default_impl! { usize, 0, "Returns the default value of `0`" }
163166
default_impl! { u8, 0, "Returns the default value of `0`" }

0 commit comments

Comments
 (0)