[−][src]Struct grep_matcher::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]
pub fn byte(byte: u8) -> LineTerminator
[src]
Return a new single-byte line terminator. Any byte is valid.
pub fn crlf() -> LineTerminator
[src]
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]
Returns true if and only if this line terminator is CRLF.
pub fn as_byte(&self) -> u8
[src]
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]
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
.
pub fn is_suffix(&self, slice: &[u8]) -> bool
[src]
Returns true if and only if the given slice ends with this line terminator.
If this line terminator is CRLF
, then this only checks whether the
last byte is \n
.
Trait Implementations
impl Clone for LineTerminator
[src]
fn clone(&self) -> LineTerminator
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl Default for LineTerminator
[src]
fn default() -> LineTerminator
[src]
impl PartialEq<LineTerminator> for LineTerminator
[src]
fn eq(&self, other: &LineTerminator) -> bool
[src]
fn ne(&self, other: &LineTerminator) -> bool
[src]
impl Copy for LineTerminator
[src]
impl Eq for LineTerminator
[src]
impl Debug for LineTerminator
[src]
impl Hash for LineTerminator
[src]
Auto Trait Implementations
impl Unpin for LineTerminator
impl Sync for LineTerminator
impl Send for LineTerminator
impl UnwindSafe for LineTerminator
impl RefUnwindSafe for LineTerminator
Blanket Implementations
impl<T> From<T> for T
[src]
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,