Struct line_wrap::TwoByteLineEnding
source · pub struct TwoByteLineEnding { /* private fields */ }
Expand description
A double byte line ending.
See crlf()
.
§Examples
use line_wrap::*;
let ending = TwoByteLineEnding::new(b'\r', b'\n');
let mut data = vec![1, 2, 3, 4, 5, 6, 255, 255, 255, 255];
assert_eq!(4, line_wrap(&mut data[..], 6, 2, &ending));
assert_eq!(vec![1, 2, b'\r', b'\n', 3, 4, b'\r', b'\n', 5, 6], data);
Implementations§
source§impl TwoByteLineEnding
impl TwoByteLineEnding
sourcepub fn new(byte0: u8, byte1: u8) -> TwoByteLineEnding
pub fn new(byte0: u8, byte1: u8) -> TwoByteLineEnding
Construct a new two byte line ending
Trait Implementations§
source§impl LineEnding for TwoByteLineEnding
impl LineEnding for TwoByteLineEnding
source§fn write_ending(&self, slice: &mut [u8])
fn write_ending(&self, slice: &mut [u8])
Write the line ending into the slice, which starts at the point where the ending should be written and is len() in length
source§fn len(&self) -> NonZeroUsize
fn len(&self) -> NonZeroUsize
The length of this particular line ending (must be constant)
Auto Trait Implementations§
impl RefUnwindSafe for TwoByteLineEnding
impl Send for TwoByteLineEnding
impl Sync for TwoByteLineEnding
impl Unpin for TwoByteLineEnding
impl UnwindSafe for TwoByteLineEnding
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