Skip to content

Commit f687b9d

Browse files
committed
Use /// style doc-comments and add missing headings
1 parent efe6564 commit f687b9d

File tree

1 file changed

+83
-72
lines changed

1 file changed

+83
-72
lines changed

src/libcore/char.rs

+83-72
Original file line numberDiff line numberDiff line change
@@ -60,25 +60,25 @@ pub fn is_alphabetic(c: char) -> bool { derived_property::Alphabetic(c) }
6060
pub fn is_XID_start(c: char) -> bool { derived_property::XID_Start(c) }
6161
pub fn is_XID_continue(c: char) -> bool { derived_property::XID_Continue(c) }
6262

63-
/**
64-
* Indicates whether a character is in lower case, defined
65-
* in terms of the Unicode General Category 'Ll'
66-
*/
63+
///
64+
/// Indicates whether a character is in lower case, defined
65+
/// in terms of the Unicode General Category 'Ll'
66+
///
6767
#[inline(always)]
6868
pub fn is_lowercase(c: char) -> bool { general_category::Ll(c) }
6969

70-
/**
71-
* Indicates whether a character is in upper case, defined
72-
* in terms of the Unicode General Category 'Lu'.
73-
*/
70+
///
71+
/// Indicates whether a character is in upper case, defined
72+
/// in terms of the Unicode General Category 'Lu'.
73+
///
7474
#[inline(always)]
7575
pub fn is_uppercase(c: char) -> bool { general_category::Lu(c) }
7676

77-
/**
78-
* Indicates whether a character is whitespace. Whitespace is defined in
79-
* terms of the Unicode General Categories 'Zs', 'Zl', 'Zp'
80-
* additional 'Cc'-category control codes in the range [0x09, 0x0d]
81-
*/
77+
///
78+
/// Indicates whether a character is whitespace. Whitespace is defined in
79+
/// terms of the Unicode General Categories 'Zs', 'Zl', 'Zp'
80+
/// additional 'Cc'-category control codes in the range [0x09, 0x0d]
81+
///
8282
#[inline(always)]
8383
pub fn is_whitespace(c: char) -> bool {
8484
('\x09' <= c && c <= '\x0d')
@@ -87,11 +87,11 @@ pub fn is_whitespace(c: char) -> bool {
8787
|| general_category::Zp(c)
8888
}
8989

90-
/**
91-
* Indicates whether a character is alphanumeric. Alphanumericness is
92-
* defined in terms of the Unicode General Categories 'Nd', 'Nl', 'No'
93-
* and the Derived Core Property 'Alphabetic'.
94-
*/
90+
///
91+
/// Indicates whether a character is alphanumeric. Alphanumericness is
92+
/// defined in terms of the Unicode General Categories 'Nd', 'Nl', 'No'
93+
/// and the Derived Core Property 'Alphabetic'.
94+
///
9595
#[inline(always)]
9696
pub fn is_alphanumeric(c: char) -> bool {
9797
derived_property::Alphabetic(c)
@@ -108,18 +108,24 @@ pub fn is_digit(c: char) -> bool {
108108
|| general_category::No(c)
109109
}
110110

111-
/**
112-
* Checks if a character parses as a numeric digit in the given radix.
113-
* Compared to `is_digit()`, this function only recognizes the
114-
* characters `0-9`, `a-z` and `A-Z`.
115-
*
116-
* Returns `true` if `c` is a valid digit under `radix`, and `false`
117-
* otherwise.
118-
*
119-
* Fails if given a `radix` > 36.
120-
*
121-
* Note: This just wraps `to_digit()`.
122-
*/
111+
///
112+
/// Checks if a character parses as a numeric digit in the given radix.
113+
/// Compared to `is_digit()`, this function only recognizes the
114+
/// characters `0-9`, `a-z` and `A-Z`.
115+
///
116+
/// # Return value
117+
///
118+
/// Returns `true` if `c` is a valid digit under `radix`, and `false`
119+
/// otherwise.
120+
///
121+
/// # Failure
122+
///
123+
/// Fails if given a `radix` > 36.
124+
///
125+
/// # Note
126+
///
127+
/// This just wraps `to_digit()`.
128+
///
123129
#[inline(always)]
124130
pub fn is_digit_radix(c: char, radix: uint) -> bool {
125131
match to_digit(c, radix) {
@@ -128,19 +134,20 @@ pub fn is_digit_radix(c: char, radix: uint) -> bool {
128134
}
129135
}
130136

131-
/**
132-
* Convert a char to the corresponding digit.
133-
*
134-
* # Return value
135-
*
136-
* If `c` is between '0' and '9', the corresponding value
137-
* between 0 and 9. If `c` is 'a' or 'A', 10. If `c` is
138-
* 'b' or 'B', 11, etc. Returns none if the char does not
139-
* refer to a digit in the given radix.
140-
*
141-
* # Failure
142-
* Fails if given a `radix` outside the range `[0..36]`.
143-
*/
137+
///
138+
/// Convert a char to the corresponding digit.
139+
///
140+
/// # Return value
141+
///
142+
/// If `c` is between '0' and '9', the corresponding value
143+
/// between 0 and 9. If `c` is 'a' or 'A', 10. If `c` is
144+
/// 'b' or 'B', 11, etc. Returns none if the char does not
145+
/// refer to a digit in the given radix.
146+
///
147+
/// # Failure
148+
///
149+
/// Fails if given a `radix` outside the range `[0..36]`.
150+
///
144151
#[inline]
145152
pub fn to_digit(c: char, radix: uint) -> Option<uint> {
146153
if radix > 36 {
@@ -156,14 +163,18 @@ pub fn to_digit(c: char, radix: uint) -> Option<uint> {
156163
else { None }
157164
}
158165

159-
/**
160-
* Converts a number to the character representing it.
161-
*
162-
* Returns `Some(char)` if `num` represents one digit under `radix`,
163-
* using one character of `0-9` or `a-z`, or `None` if it doesn't.
164-
*
165-
* Fails if given an `radix` > 36.
166-
*/
166+
///
167+
/// Converts a number to the character representing it.
168+
///
169+
/// # Return value
170+
///
171+
/// Returns `Some(char)` if `num` represents one digit under `radix`,
172+
/// using one character of `0-9` or `a-z`, or `None` if it doesn't.
173+
///
174+
/// # Failure
175+
///
176+
/// Fails if given an `radix` > 36.
177+
///
167178
#[inline]
168179
pub fn from_digit(num: uint, radix: uint) -> Option<char> {
169180
if radix > 36 {
@@ -195,15 +206,15 @@ pub fn escape_unicode(c: char) -> ~str {
195206
out
196207
}
197208

198-
/**
199-
* Return the hexadecimal unicode escape of a char.
200-
*
201-
* The rules are as follows:
202-
*
203-
* - chars in [0,0xff] get 2-digit escapes: `\\xNN`
204-
* - chars in [0x100,0xffff] get 4-digit escapes: `\\uNNNN`
205-
* - chars above 0x10000 get 8-digit escapes: `\\UNNNNNNNN`
206-
*/
209+
///
210+
/// Return the hexadecimal unicode escape of a char.
211+
///
212+
/// The rules are as follows:
213+
///
214+
/// - chars in [0,0xff] get 2-digit escapes: `\\xNN`
215+
/// - chars in [0x100,0xffff] get 4-digit escapes: `\\uNNNN`
216+
/// - chars above 0x10000 get 8-digit escapes: `\\UNNNNNNNN`
217+
///
207218
#[cfg(not(stage0))]
208219
pub fn escape_unicode(c: char) -> ~str {
209220
let s = u32::to_str_radix(c as u32, 16u);
@@ -222,18 +233,18 @@ pub fn escape_unicode(c: char) -> ~str {
222233
out
223234
}
224235

225-
/**
226-
* Return a 'default' ASCII and C++11-like char-literal escape of a char.
227-
*
228-
* The default is chosen with a bias toward producing literals that are
229-
* legal in a variety of languages, including C++11 and similar C-family
230-
* languages. The exact rules are:
231-
*
232-
* - Tab, CR and LF are escaped as '\t', '\r' and '\n' respectively.
233-
* - Single-quote, double-quote and backslash chars are backslash-escaped.
234-
* - Any other chars in the range [0x20,0x7e] are not escaped.
235-
* - Any other chars are given hex unicode escapes; see `escape_unicode`.
236-
*/
236+
///
237+
/// Return a 'default' ASCII and C++11-like char-literal escape of a char.
238+
///
239+
/// The default is chosen with a bias toward producing literals that are
240+
/// legal in a variety of languages, including C++11 and similar C-family
241+
/// languages. The exact rules are:
242+
///
243+
/// - Tab, CR and LF are escaped as '\t', '\r' and '\n' respectively.
244+
/// - Single-quote, double-quote and backslash chars are backslash-escaped.
245+
/// - Any other chars in the range [0x20,0x7e] are not escaped.
246+
/// - Any other chars are given hex unicode escapes; see `escape_unicode`.
247+
///
237248
pub fn escape_default(c: char) -> ~str {
238249
match c {
239250
'\t' => ~"\\t",

0 commit comments

Comments
 (0)