Struct line_wrap::ByteLineEnding
source · pub struct ByteLineEnding { /* private fields */ }
Expand description
A single byte line ending.
See lf()
.
§Examples
use line_wrap::*;
let ending = ByteLineEnding::new(b'\n');
let mut data = vec![1, 2, 3, 4, 5, 6, 255, 255];
assert_eq!(2, line_wrap(&mut data[..], 6, 2, &ending));
assert_eq!(vec![1, 2, b'\n', 3, 4, b'\n', 5, 6], data);
Implementations§
source§impl ByteLineEnding
impl ByteLineEnding
sourcepub fn new(byte: u8) -> ByteLineEnding
pub fn new(byte: u8) -> ByteLineEnding
Construct a new single byte line ending
Trait Implementations§
source§impl LineEnding for ByteLineEnding
impl LineEnding for ByteLineEnding
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 ByteLineEnding
impl Send for ByteLineEnding
impl Sync for ByteLineEnding
impl Unpin for ByteLineEnding
impl UnwindSafe for ByteLineEnding
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