Struct grep_matcher::LineTerminator [−][src]
pub struct LineTerminator(_);
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.
Methods
impl LineTerminator
[src]
impl LineTerminator
pub fn byte(byte: u8) -> LineTerminator
[src]
pub fn byte(byte: u8) -> LineTerminator
Return a new single-byte line terminator. Any byte is valid.
pub fn crlf() -> LineTerminator
[src]
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
.
pub fn is_crlf(&self) -> bool
[src]
pub fn is_crlf(&self) -> bool
Returns true if and only if this line terminator is CRLF.
pub fn as_byte(&self) -> u8
[src]
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
.
pub fn as_bytes(&self) -> &[u8]
[src]
pub fn as_bytes(&self) -> &[u8]
Returns this line terminator as a sequence of bytes.
This returns a singleton sequence for all line terminators except for
CRLF
, in which case, it returns \r\n
.
The slice returned is guaranteed to have length at least 1
.
Trait Implementations
impl Clone for LineTerminator
[src]
impl Clone for LineTerminator
fn clone(&self) -> LineTerminator
[src]
fn clone(&self) -> LineTerminator
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
impl Copy for LineTerminator
[src]
impl Copy for LineTerminator
impl Debug for LineTerminator
[src]
impl Debug for LineTerminator
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl Eq for LineTerminator
[src]
impl Eq for LineTerminator
impl Hash for LineTerminator
[src]
impl Hash for LineTerminator
fn hash<__H: Hasher>(&self, state: &mut __H)
[src]
fn hash<__H: Hasher>(&self, state: &mut __H)
Feeds this value into the given [Hasher
]. Read more
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
Feeds a slice of this type into the given [Hasher
]. Read more
impl PartialEq for LineTerminator
[src]
impl PartialEq for LineTerminator
fn eq(&self, other: &LineTerminator) -> bool
[src]
fn eq(&self, other: &LineTerminator) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &LineTerminator) -> bool
[src]
fn ne(&self, other: &LineTerminator) -> bool
This method tests for !=
.
impl Default for LineTerminator
[src]
impl Default for LineTerminator
fn default() -> LineTerminator
[src]
fn default() -> LineTerminator
Returns the "default value" for a type. Read more
Auto Trait Implementations
impl Send for LineTerminator
impl Send for LineTerminator
impl Sync for LineTerminator
impl Sync for LineTerminator