@@ -29,11 +29,11 @@ impl char {
29
29
pub const REPLACEMENT_CHARACTER : char = '\u{FFFD}' ;
30
30
31
31
/// The version of [Unicode](https://www.unicode.org/) that the Unicode parts of
32
- /// `char` and `str` methods are based on.
32
+ /// `char` and [ `str`] methods are based on.
33
33
///
34
34
/// New versions of Unicode are released regularly and subsequently all methods
35
35
/// in the standard library depending on Unicode are updated. Therefore the
36
- /// behavior of some `char` and `str` methods and the value of this constant
36
+ /// behavior of some `char` and [ `str`] methods and the value of this constant
37
37
/// changes over time. This is *not* considered to be a breaking change.
38
38
///
39
39
/// The version numbering scheme is explained in
@@ -42,7 +42,7 @@ impl char {
42
42
pub const UNICODE_VERSION : ( u8 , u8 , u8 ) = crate :: unicode:: UNICODE_VERSION ;
43
43
44
44
/// Creates an iterator over the UTF-16 encoded code points in `iter`,
45
- /// returning unpaired surrogates as `Err`s.
45
+ /// returning unpaired surrogates as [ `Err`] s.
46
46
///
47
47
/// # Examples
48
48
///
@@ -70,7 +70,7 @@ impl char {
70
70
/// );
71
71
/// ```
72
72
///
73
- /// A lossy decoder can be obtained by replacing `Err` results with the replacement character:
73
+ /// A lossy decoder can be obtained by replacing [ `Err`] results with the replacement character:
74
74
///
75
75
/// ```
76
76
/// use std::char::{decode_utf16, REPLACEMENT_CHARACTER};
@@ -93,10 +93,10 @@ impl char {
93
93
super :: decode:: decode_utf16 ( iter)
94
94
}
95
95
96
- /// Converts a `u32` to a `char`.
96
+ /// Converts a [ `u32`] to a `char`.
97
97
///
98
98
/// Note that all `char`s are valid [`u32`]s, and can be cast to one with
99
- /// `as`:
99
+ /// [ `as`](keyword.as.html) :
100
100
///
101
101
/// ```
102
102
/// let c = '💯';
@@ -106,7 +106,7 @@ impl char {
106
106
/// ```
107
107
///
108
108
/// However, the reverse is not true: not all valid [`u32`]s are valid
109
- /// `char`s. `from_u32()` will return `None` if the input is not a valid value
109
+ /// `char`s. `from_u32()` will return [ `None`] if the input is not a valid value
110
110
/// for a `char`.
111
111
///
112
112
/// For an unsafe version of this function which ignores these checks, see
@@ -126,7 +126,7 @@ impl char {
126
126
/// assert_eq!(Some('❤'), c);
127
127
/// ```
128
128
///
129
- /// Returning `None` when the input is not a valid `char`:
129
+ /// Returning [ `None`] when the input is not a valid `char`:
130
130
///
131
131
/// ```
132
132
/// use std::char;
@@ -141,7 +141,7 @@ impl char {
141
141
super :: convert:: from_u32 ( i)
142
142
}
143
143
144
- /// Converts a `u32` to a `char`, ignoring validity.
144
+ /// Converts a [ `u32`] to a `char`, ignoring validity.
145
145
///
146
146
/// Note that all `char`s are valid [`u32`]s, and can be cast to one with
147
147
/// `as`:
@@ -190,7 +190,7 @@ impl char {
190
190
/// sixteen, hexadecimal, to give some common values. Arbitrary
191
191
/// radices are supported.
192
192
///
193
- /// `from_digit()` will return `None` if the input is not a digit in
193
+ /// `from_digit()` will return [ `None`] if the input is not a digit in
194
194
/// the given radix.
195
195
///
196
196
/// # Panics
@@ -214,7 +214,7 @@ impl char {
214
214
/// assert_eq!(Some('b'), c);
215
215
/// ```
216
216
///
217
- /// Returning `None` when the input is not a digit:
217
+ /// Returning [ `None`] when the input is not a digit:
218
218
///
219
219
/// ```
220
220
/// use std::char;
@@ -299,7 +299,7 @@ impl char {
299
299
///
300
300
/// # Errors
301
301
///
302
- /// Returns `None` if the `char` does not refer to a digit in the given radix.
302
+ /// Returns [ `None`] if the `char` does not refer to a digit in the given radix.
303
303
///
304
304
/// # Panics
305
305
///
@@ -360,7 +360,7 @@ impl char {
360
360
/// println!();
361
361
/// ```
362
362
///
363
- /// Using `println!` directly:
363
+ /// Using [ `println!`](macro.println.html) directly:
364
364
///
365
365
/// ```
366
366
/// println!("{}", '❤'.escape_unicode());
@@ -372,7 +372,7 @@ impl char {
372
372
/// println!("\\u{{2764}}");
373
373
/// ```
374
374
///
375
- /// Using `to_string`:
375
+ /// Using [ `to_string`](string/trait.ToString.html#tymethod.to_string) :
376
376
///
377
377
/// ```
378
378
/// assert_eq!('❤'.escape_unicode().to_string(), "\\u{2764}");
@@ -422,8 +422,8 @@ impl char {
422
422
/// Returns an iterator that yields the literal escape code of a character
423
423
/// as `char`s.
424
424
///
425
- /// This will escape the characters similar to the `Debug` implementations
426
- /// of `str` or `char`.
425
+ /// This will escape the characters similar to the [ `Debug`](core::fmt::Debug) implementations
426
+ /// of [ `str`] or `char`.
427
427
///
428
428
/// # Examples
429
429
///
@@ -436,7 +436,7 @@ impl char {
436
436
/// println!();
437
437
/// ```
438
438
///
439
- /// Using `println!` directly:
439
+ /// Using [ `println!`](macro.println.html) directly:
440
440
///
441
441
/// ```
442
442
/// println!("{}", '\n'.escape_debug());
@@ -448,7 +448,7 @@ impl char {
448
448
/// println!("\\n");
449
449
/// ```
450
450
///
451
- /// Using `to_string`:
451
+ /// Using [ `to_string`](string/trait.ToString.html#tymethod.to_string) :
452
452
///
453
453
/// ```
454
454
/// assert_eq!('\n'.escape_debug().to_string(), "\\n");
@@ -490,7 +490,7 @@ impl char {
490
490
/// println!();
491
491
/// ```
492
492
///
493
- /// Using `println!` directly:
493
+ /// Using [ `println!`](macro.println.html) directly:
494
494
///
495
495
/// ```
496
496
/// println!("{}", '"'.escape_default());
@@ -502,7 +502,7 @@ impl char {
502
502
/// println!("\\\"");
503
503
/// ```
504
504
///
505
- /// Using `to_string`:
505
+ /// Using [ `to_string`](string/trait.ToString.html#tymethod.to_string) :
506
506
///
507
507
/// ```
508
508
/// assert_eq!('"'.escape_default().to_string(), "\\\"");
@@ -543,8 +543,9 @@ impl char {
543
543
/// assert_eq!(len, 4);
544
544
/// ```
545
545
///
546
- /// The `&str` type guarantees that its contents are UTF-8, and so we can compare the length it
547
- /// would take if each code point was represented as a `char` vs in the `&str` itself:
546
+ /// The <code>[&](reference)[str]</code> type guarantees that its contents are UTF-8,
547
+ /// and so we can compare the length it would take if each code point was represented
548
+ /// as a `char` vs in the <code>[&](reference)[str]</code> itself:
548
549
///
549
550
/// ```
550
551
/// // as chars
@@ -637,7 +638,7 @@ impl char {
637
638
unsafe { from_utf8_unchecked_mut ( encode_utf8_raw ( self as u32 , dst) ) }
638
639
}
639
640
640
- /// Encodes this character as UTF-16 into the provided `u16` buffer,
641
+ /// Encodes this character as UTF-16 into the provided [ `u16`] buffer,
641
642
/// and then returns the subslice of the buffer that contains the encoded character.
642
643
///
643
644
/// # Panics
@@ -647,7 +648,7 @@ impl char {
647
648
///
648
649
/// # Examples
649
650
///
650
- /// In both of these examples, '𝕊' takes two `u16`s to encode.
651
+ /// In both of these examples, '𝕊' takes two [ `u16`] s to encode.
651
652
///
652
653
/// ```
653
654
/// let mut b = [0; 2];
@@ -671,7 +672,7 @@ impl char {
671
672
encode_utf16_raw ( self as u32 , dst)
672
673
}
673
674
674
- /// Returns `true` if this `char` has the `Alphabetic` property.
675
+ /// Returns [ `true`](keyword.true.html) if this `char` has the `Alphabetic` property.
675
676
///
676
677
/// `Alphabetic` is described in Chapter 4 (Character Properties) of the [Unicode Standard] and
677
678
/// specified in the [Unicode Character Database][ucd] [`DerivedCoreProperties.txt`].
@@ -701,7 +702,7 @@ impl char {
701
702
}
702
703
}
703
704
704
- /// Returns `true` if this `char` has the `Lowercase` property.
705
+ /// Returns [ `true`](keyword.true.html) if this `char` has the `Lowercase` property.
705
706
///
706
707
/// `Lowercase` is described in Chapter 4 (Character Properties) of the [Unicode Standard] and
707
708
/// specified in the [Unicode Character Database][ucd] [`DerivedCoreProperties.txt`].
@@ -733,7 +734,7 @@ impl char {
733
734
}
734
735
}
735
736
736
- /// Returns `true` if this `char` has the `Uppercase` property.
737
+ /// Returns [ `true`](keyword.true.html) if this `char` has the `Uppercase` property.
737
738
///
738
739
/// `Uppercase` is described in Chapter 4 (Character Properties) of the [Unicode Standard] and
739
740
/// specified in the [Unicode Character Database][ucd] [`DerivedCoreProperties.txt`].
@@ -765,7 +766,7 @@ impl char {
765
766
}
766
767
}
767
768
768
- /// Returns `true` if this `char` has the `White_Space` property.
769
+ /// Returns [ `true`](keyword.true.html) if this `char` has the `White_Space` property.
769
770
///
770
771
/// `White_Space` is specified in the [Unicode Character Database][ucd] [`PropList.txt`].
771
772
///
@@ -793,7 +794,8 @@ impl char {
793
794
}
794
795
}
795
796
796
- /// Returns `true` if this `char` satisfies either [`is_alphabetic()`] or [`is_numeric()`].
797
+ /// Returns [`true`](keyword.true.html) if this `char` satisfies either
798
+ /// [`is_alphabetic()`] or [`is_numeric()`].
797
799
///
798
800
/// [`is_alphabetic()`]: #method.is_alphabetic
799
801
/// [`is_numeric()`]: #method.is_numeric
@@ -818,7 +820,7 @@ impl char {
818
820
self . is_alphabetic ( ) || self . is_numeric ( )
819
821
}
820
822
821
- /// Returns `true` if this `char` has the general category for control codes.
823
+ /// Returns [ `true`](keyword.true.html) if this `char` has the general category for control codes.
822
824
///
823
825
/// Control codes (code points with the general category of `Cc`) are described in Chapter 4
824
826
/// (Character Properties) of the [Unicode Standard] and specified in the [Unicode Character
@@ -843,7 +845,7 @@ impl char {
843
845
unicode:: Cc ( self )
844
846
}
845
847
846
- /// Returns `true` if this `char` has the `Grapheme_Extend` property.
848
+ /// Returns [ `true`](keyword.true.html) if this `char` has the `Grapheme_Extend` property.
847
849
///
848
850
/// `Grapheme_Extend` is described in [Unicode Standard Annex #29 (Unicode Text
849
851
/// Segmentation)][uax29] and specified in the [Unicode Character Database][ucd]
@@ -857,7 +859,7 @@ impl char {
857
859
unicode:: Grapheme_Extend ( self )
858
860
}
859
861
860
- /// Returns `true` if this `char` has one of the general categories for numbers.
862
+ /// Returns [ `true`](keyword.true.html) if this `char` has one of the general categories for numbers.
861
863
///
862
864
/// The general categories for numbers (`Nd` for decimal digits, `Nl` for letter-like numeric
863
865
/// characters, and `No` for other numeric characters) are specified in the [Unicode Character
@@ -925,7 +927,7 @@ impl char {
925
927
/// println!();
926
928
/// ```
927
929
///
928
- /// Using `println!` directly:
930
+ /// Using [ `println!`](macro.println.html) directly:
929
931
///
930
932
/// ```
931
933
/// println!("{}", 'İ'.to_lowercase());
@@ -937,7 +939,7 @@ impl char {
937
939
/// println!("i\u{307}");
938
940
/// ```
939
941
///
940
- /// Using `to_string`:
942
+ /// Using [ `to_string`](string/trait.ToString.html#tymethod.to_string) :
941
943
///
942
944
/// ```
943
945
/// assert_eq!('C'.to_lowercase().to_string(), "c");
@@ -990,7 +992,7 @@ impl char {
990
992
/// println!();
991
993
/// ```
992
994
///
993
- /// Using `println!` directly:
995
+ /// Using [ `println!`](macro.println.html) directly:
994
996
///
995
997
/// ```
996
998
/// println!("{}", 'ß'.to_uppercase());
@@ -1002,7 +1004,7 @@ impl char {
1002
1004
/// println!("SS");
1003
1005
/// ```
1004
1006
///
1005
- /// Using `to_string`:
1007
+ /// Using [ `to_string`](string/trait.ToString.html#tymethod.to_string) :
1006
1008
///
1007
1009
/// ```
1008
1010
/// assert_eq!('c'.to_uppercase().to_string(), "C");
@@ -1131,7 +1133,7 @@ impl char {
1131
1133
1132
1134
/// Checks that two values are an ASCII case-insensitive match.
1133
1135
///
1134
- /// Equivalent to ` to_ascii_lowercase(a) == to_ascii_lowercase(b)` .
1136
+ /// Equivalent to <code>[ to_ascii_lowercase]\ (a) == [ to_ascii_lowercase]\ (b)</code> .
1135
1137
///
1136
1138
/// # Examples
1137
1139
///
@@ -1144,6 +1146,8 @@ impl char {
1144
1146
/// assert!(upper_a.eq_ignore_ascii_case(&upper_a));
1145
1147
/// assert!(!upper_a.eq_ignore_ascii_case(&lower_z));
1146
1148
/// ```
1149
+ ///
1150
+ /// [to_ascii_lowercase]: #method.to_ascii_lowercase
1147
1151
#[ stable( feature = "ascii_methods_on_intrinsics" , since = "1.23.0" ) ]
1148
1152
#[ rustc_const_stable( feature = "const_ascii_methods_on_intrinsics" , since = "1.52.0" ) ]
1149
1153
#[ inline]
0 commit comments