Skip to content

Commit 498da9f

Browse files
committed
Rollup merge of rust-lang#40837 - alanstoate:ascii-docs, r=steveklabnik
change string references in asciiext
2 parents 8cfc93f + 1579fbd commit 498da9f

File tree

1 file changed

+15
-9
lines changed

1 file changed

+15
-9
lines changed

src/libstd/ascii.rs

+15-9
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ use mem;
1717
use ops::Range;
1818
use iter::FusedIterator;
1919

20-
/// Extension methods for ASCII-subset only operations on string slices.
20+
/// Extension methods for ASCII-subset only operations.
2121
///
2222
/// Be aware that operations on seemingly non-ASCII characters can sometimes
2323
/// have unexpected results. Consider this example:
@@ -54,19 +54,21 @@ pub trait AsciiExt {
5454
///
5555
/// let ascii = 'a';
5656
/// let utf8 = '❤';
57+
/// let int_ascii = 97;
5758
///
5859
/// assert!(ascii.is_ascii());
5960
/// assert!(!utf8.is_ascii());
61+
/// assert!(int_ascii.is_ascii());
6062
/// ```
6163
#[stable(feature = "rust1", since = "1.0.0")]
6264
fn is_ascii(&self) -> bool;
6365

64-
/// Makes a copy of the string in ASCII upper case.
66+
/// Makes a copy of the value in its ASCII upper case equivalent.
6567
///
6668
/// ASCII letters 'a' to 'z' are mapped to 'A' to 'Z',
6769
/// but non-ASCII letters are unchanged.
6870
///
69-
/// To uppercase the string in-place, use [`make_ascii_uppercase`].
71+
/// To uppercase the value in-place, use [`make_ascii_uppercase`].
7072
///
7173
/// To uppercase ASCII characters in addition to non-ASCII characters, use
7274
/// [`str::to_uppercase`].
@@ -78,22 +80,24 @@ pub trait AsciiExt {
7880
///
7981
/// let ascii = 'a';
8082
/// let utf8 = '❤';
83+
/// let int_ascii = 97;
8184
///
8285
/// assert_eq!('A', ascii.to_ascii_uppercase());
8386
/// assert_eq!('❤', utf8.to_ascii_uppercase());
87+
/// assert_eq!(65, int_ascii.to_ascii_uppercase());
8488
/// ```
8589
///
8690
/// [`make_ascii_uppercase`]: #tymethod.make_ascii_uppercase
8791
/// [`str::to_uppercase`]: ../primitive.str.html#method.to_uppercase
8892
#[stable(feature = "rust1", since = "1.0.0")]
8993
fn to_ascii_uppercase(&self) -> Self::Owned;
9094

91-
/// Makes a copy of the string in ASCII lower case.
95+
/// Makes a copy of the value in its ASCII lower case equivalent.
9296
///
9397
/// ASCII letters 'A' to 'Z' are mapped to 'a' to 'z',
9498
/// but non-ASCII letters are unchanged.
9599
///
96-
/// To lowercase the string in-place, use [`make_ascii_lowercase`].
100+
/// To lowercase the value in-place, use [`make_ascii_lowercase`].
97101
///
98102
/// To lowercase ASCII characters in addition to non-ASCII characters, use
99103
/// [`str::to_lowercase`].
@@ -105,20 +109,22 @@ pub trait AsciiExt {
105109
///
106110
/// let ascii = 'A';
107111
/// let utf8 = '❤';
112+
/// let int_ascii = 65;
108113
///
109114
/// assert_eq!('a', ascii.to_ascii_lowercase());
110115
/// assert_eq!('❤', utf8.to_ascii_lowercase());
116+
/// assert_eq!(97, int_ascii.to_ascii_lowercase());
111117
/// ```
112118
///
113119
/// [`make_ascii_lowercase`]: #tymethod.make_ascii_lowercase
114120
/// [`str::to_lowercase`]: ../primitive.str.html#method.to_lowercase
115121
#[stable(feature = "rust1", since = "1.0.0")]
116122
fn to_ascii_lowercase(&self) -> Self::Owned;
117123

118-
/// Checks that two strings are an ASCII case-insensitive match.
124+
/// Checks that two values are an ASCII case-insensitive match.
119125
///
120126
/// Same as `to_ascii_lowercase(a) == to_ascii_lowercase(b)`,
121-
/// but without allocating and copying temporary strings.
127+
/// but without allocating and copying temporaries.
122128
///
123129
/// # Examples
124130
///
@@ -142,7 +148,7 @@ pub trait AsciiExt {
142148
/// ASCII letters 'a' to 'z' are mapped to 'A' to 'Z',
143149
/// but non-ASCII letters are unchanged.
144150
///
145-
/// To return a new uppercased string without modifying the existing one, use
151+
/// To return a new uppercased value without modifying the existing one, use
146152
/// [`to_ascii_uppercase`].
147153
///
148154
/// # Examples
@@ -166,7 +172,7 @@ pub trait AsciiExt {
166172
/// ASCII letters 'A' to 'Z' are mapped to 'a' to 'z',
167173
/// but non-ASCII letters are unchanged.
168174
///
169-
/// To return a new lowercased string without modifying the existing one, use
175+
/// To return a new lowercased value without modifying the existing one, use
170176
/// [`to_ascii_lowercase`].
171177
///
172178
/// # Examples

0 commit comments

Comments
 (0)