pub struct EmailWriter<'a> { /* private fields */ }
Expand description
Wrapper around Write
that remembers the length of the
last line written to it.
Implementations§
Source§impl<'a> EmailWriter<'a>
impl<'a> EmailWriter<'a>
Sourcepub fn new(
writer: &'a mut dyn Write,
line_len: usize,
spaces: usize,
optional_breakpoint: bool,
can_go_to_new_line_now: bool,
) -> Self
pub fn new( writer: &'a mut dyn Write, line_len: usize, spaces: usize, optional_breakpoint: bool, can_go_to_new_line_now: bool, ) -> Self
Construct a new EmailWriter
.
line_len
is the length of the last line inwriter
.spaces
the number of spaces that must be written before the next write.can_go_to_new_line_now
is whether the current line can be wrapped now or not.
Sourcepub fn optional_breakpoint(&mut self)
pub fn optional_breakpoint(&mut self)
Write a space which won’t be printed if the line wraps.
This method shouldn’t be called multiple times consecutively, and will panic if debug assertions are on.
Sourcepub fn line_len(&self) -> usize
pub fn line_len(&self) -> usize
Get the length in bytes of the last line written to the inner writer.
Sourcepub fn projected_line_len(&self) -> usize
pub fn projected_line_len(&self) -> usize
Get the length in bytes of the last line written to the inner writer plus the spaces which might be written to in on the next write call.
Sourcepub fn folding<'b>(&'b mut self) -> FoldingEmailWriter<'a, 'b>
pub fn folding<'b>(&'b mut self) -> FoldingEmailWriter<'a, 'b>
Get a Write
r which automatically line folds text written to it.
Trait Implementations§
Source§impl<'a> Drop for EmailWriter<'a>
impl<'a> Drop for EmailWriter<'a>
Auto Trait Implementations§
impl<'a> Freeze for EmailWriter<'a>
impl<'a> !RefUnwindSafe for EmailWriter<'a>
impl<'a> !Send for EmailWriter<'a>
impl<'a> !Sync for EmailWriter<'a>
impl<'a> Unpin for EmailWriter<'a>
impl<'a> !UnwindSafe for EmailWriter<'a>
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