[−][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
funcreturned an errorhandle.undo_header()is called, this won't undo anything before afinish_header()call but will discard partial writes - if
funcsucceededhandle.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 RefUnwindSafe for EncodingBuffer
impl Send for EncodingBuffer
impl Sync for EncodingBuffer
impl Unpin for EncodingBuffer
impl UnwindSafe for EncodingBuffer
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized, [src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T[src]
impl<T> From<T> for T[src]
impl<T, U> Into<U> for T where
U: From<T>, [src]
U: From<T>,
impl<T, U> TryFrom<U> 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, U> TryInto<U> for T where
U: TryFrom<T>, [src]
U: TryFrom<T>,