pub struct LineTerminator(/* private fields */);
Expand description
A line terminator.
A line terminator represents the end of a line. Generally, every line is either “terminated” by the end of a stream or a specific byte (or sequence of bytes).
Generally, a line terminator is a single byte, specifically, \n
, on
Unix-like systems. On Windows, a line terminator is \r\n
(referred to
as CRLF
for Carriage Return; Line Feed
).
The default line terminator is \n
on all platforms.
Implementations§
Source§impl LineTerminator
impl LineTerminator
Sourcepub fn byte(byte: u8) -> LineTerminator
pub fn byte(byte: u8) -> LineTerminator
Return a new single-byte line terminator. Any byte is valid.
Sourcepub fn crlf() -> LineTerminator
pub fn crlf() -> LineTerminator
Return a new line terminator represented by \r\n
.
When this option is used, consumers may generally treat a lone \n
as
a line terminator in addition to \r\n
.
Sourcepub fn as_byte(&self) -> u8
pub fn as_byte(&self) -> u8
Returns this line terminator as a single byte.
If the line terminator is CRLF, then this returns \n
. This is
useful for routines that, for example, find line boundaries by treating
\n
as a line terminator even when it isn’t preceded by \r
.
Trait Implementations§
Source§impl Clone for LineTerminator
impl Clone for LineTerminator
Source§fn clone(&self) -> LineTerminator
fn clone(&self) -> LineTerminator
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more