Skip to content

Commit abcae00

Browse files
truncate: updated documentation
1. The documentation for parse_mode_and_size() has been updated. 2. Added documentation for TruncateMode::is_absolute(). Signed-off-by: Jean-Christian CÎRSTEA <[email protected]>
1 parent e5e64f9 commit abcae00

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/uu/truncate/src/truncate.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,11 @@ impl TruncateMode {
7979
}
8080
}
8181

82+
/// Determine if mode is absolute
83+
///
84+
/// # Returns
85+
///
86+
/// `true` is self matches Self::Absolute(_), `false` otherwise.
8287
fn is_absolute(&self) -> bool {
8388
matches!(self, Self::Absolute(_))
8489
}
@@ -301,13 +306,12 @@ fn is_modifier(c: char) -> bool {
301306
///
302307
/// # Panics
303308
///
304-
/// If `size_string` is empty, or if no number could be parsed from the
305-
/// given string (for example, if the string were `"abc"`).
309+
/// If `size_string` is empty.
306310
///
307311
/// # Examples
308312
///
309313
/// ```rust,ignore
310-
/// assert_eq!(parse_mode_and_size("+123"), (TruncateMode::Extend, 123));
314+
/// assert_eq!(parse_mode_and_size("+123"), Ok(TruncateMode::Extend(123)));
311315
/// ```
312316
fn parse_mode_and_size(size_string: &str) -> Result<TruncateMode, ParseSizeError> {
313317
// Trim any whitespace.

0 commit comments

Comments
 (0)