Struct grep_matcher::LineTerminator
source · 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 moresource§impl Debug for LineTerminator
impl Debug for LineTerminator
source§impl Default for LineTerminator
impl Default for LineTerminator
source§fn default() -> LineTerminator
fn default() -> LineTerminator
source§impl Hash for LineTerminator
impl Hash for LineTerminator
source§impl PartialEq for LineTerminator
impl PartialEq for LineTerminator
source§fn eq(&self, other: &LineTerminator) -> bool
fn eq(&self, other: &LineTerminator) -> bool
self
and other
values to be equal, and is used
by ==
.