/// Supported line endings. Like in the Rust standard library, two line /// endings are supported: `\r\n` and `\n` #[derive(Clone, Copy, Debug, PartialEq, Eq)] pubenum LineEnding { /// _Carriage return and line feed_ – a line ending sequence /// historically used in Windows. Corresponds to the sequence /// of ASCII control characters `0x0D 0x0A` or `\r\n`
CRLF, /// _Line feed_ – a line ending historically used in Unix. /// Corresponds to the ASCII control character `0x0A` or `\n`
LF,
}
impl LineEnding { /// Turns this [`LineEnding`] value into its ASCII representation. #[inline] pubconstfn as_str(&self) -> &'static str { matchself { Self::CRLF => "\r\n", Self::LF => "\n",
}
}
}
/// An iterator over the lines of a string, as tuples of string slice /// and [`LineEnding`] value; it only emits non-empty lines (i.e. having /// some content before the terminating `\r\n` or `\n`). /// /// This struct is used internally by the library. #[derive(Debug, Clone, Copy)] pub(crate) struct NonEmptyLines<'a>(pub &'a str);
impl<'a> Iterator for NonEmptyLines<'a> { type Item = (&'a str, Option<LineEnding>);
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.