[−][src]Struct mail_internals::encoder::EncodingBuffer
EncodingBuffer for a Mail providing a buffer for encodable traits.
Methods
impl EncodingBuffer
[src]
pub fn new(mail_type: MailType) -> Self
[src]
Create a new buffer only allowing input compatible with a the specified mail type.
pub fn mail_type(&self) -> MailType
[src]
Returns the mail type for which the buffer was created.
pub fn writer(&mut self) -> EncodingWriter
[src]
returns a new EncodingWriter which contains a mutable reference to the current string buffer
pub fn write_header_line<FN>(&mut self, func: FN) -> Result<(), EncodingError> where
FN: FnOnce(&mut EncodingWriter) -> Result<(), EncodingError>,
[src]
FN: FnOnce(&mut EncodingWriter) -> Result<(), EncodingError>,
calls the provided function with a EncodingWriter cleaning up afterwards
After calling func
with the EncodingWriter following cleanup is performed:
- if
func
returned an errorhandle.undo_header()
is called, this won't undo anything before afinish_header()
call but will discard partial writes - if
func
succeededhandle.finish_header()
is called
pub fn write_blank_line(&mut self)
[src]
pub fn write_body_unchecked(&mut self, body: &impl AsRef<[u8]>)
[src]
writes a body to the internal buffer, without verifying it's correctness
pub fn as_str(&self) -> Result<&str, EncodingError>
[src]
Error
This can fail if a body does not contain valid utf8.
pub fn to_string(&self) -> Result<String, EncodingError>
[src]
Converts the internal buffer into an utf-8 string if possible.
pub fn to_string_lossy(&self) -> Cow<str>
[src]
Lossy conversion of the internal buffer to an string.
pub fn as_slice(&self) -> &[u8]
[src]
Return a slice view to the underlying buffer.
Trait Implementations
Auto Trait Implementations
impl Send for EncodingBuffer
impl Sync for EncodingBuffer
Blanket Implementations
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From for T
[src]
impl<T, U> TryFrom 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> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto 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> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,