pub enum LineEnding {
Lf,
Crlf,
}Expand description
The preferred newline sequence used when saving a document.
Variants§
Implementations§
Source§impl LineEnding
impl LineEnding
Sourcepub fn detect_in_text(text: &str) -> Self
pub fn detect_in_text(text: &str) -> Self
Detect the dominant line ending from a source text.
Policy: if the input contains any CRLF ("\r\n"), returns LineEnding::Crlf,
otherwise LineEnding::Lf.
Sourcepub fn apply_to_text(self, text: &str) -> String
pub fn apply_to_text(self, text: &str) -> String
Convert an LF-normalized text to this line ending for saving.
Trait Implementations§
Source§impl Clone for LineEnding
impl Clone for LineEnding
Source§fn clone(&self) -> LineEnding
fn clone(&self) -> LineEnding
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for LineEnding
impl Debug for LineEnding
Source§impl PartialEq for LineEnding
impl PartialEq for LineEnding
impl Copy for LineEnding
impl Eq for LineEnding
impl StructuralPartialEq for LineEnding
Auto Trait Implementations§
impl Freeze for LineEnding
impl RefUnwindSafe for LineEnding
impl Send for LineEnding
impl Sync for LineEnding
impl Unpin for LineEnding
impl UnsafeUnpin for LineEnding
impl UnwindSafe for LineEnding
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more