Trait iri_string::task::ProcessAndWrite
source · [−]pub trait ProcessAndWrite: Sized {
type OutputBorrowed: ?Sized;
type OutputOwned;
type ProcessError: Display;
fn allocate_and_write(
self
) -> Result<Self::OutputOwned, Error<Self::ProcessError>>;
fn write_to_byte_slice(
self,
buf: &mut [u8]
) -> Result<&Self::OutputBorrowed, Error<Self::ProcessError>>;
fn try_append_to_std_string(
self,
buf: &mut String
) -> Result<&Self::OutputBorrowed, Error<Self::ProcessError>>;
fn append_to_std_string(
self,
buf: &mut String
) -> Result<&Self::OutputBorrowed, Self::ProcessError> { ... }
}Expand description
Processes the data and write it somewhere.
Required Associated Types
type OutputBorrowed: ?Sized
type OutputBorrowed: ?Sized
Borrowed output types.
type OutputOwned
type OutputOwned
Owned output types.
type ProcessError: Display
type ProcessError: Display
Data processing error.
Required Methods
fn allocate_and_write(
self
) -> Result<Self::OutputOwned, Error<Self::ProcessError>>
fn allocate_and_write(
self
) -> Result<Self::OutputOwned, Error<Self::ProcessError>>
Processes the data, and writes it to the newly allocated buffer.
Failures
This fails if:
- failed to allocate memory, or
- failed to process data.
fn write_to_byte_slice(
self,
buf: &mut [u8]
) -> Result<&Self::OutputBorrowed, Error<Self::ProcessError>>
fn write_to_byte_slice(
self,
buf: &mut [u8]
) -> Result<&Self::OutputBorrowed, Error<Self::ProcessError>>
Processes the data, and writes it to the given byte slice.
Failures
This fails if:
- buffer is not large enough, or
- failed to process data.
fn try_append_to_std_string(
self,
buf: &mut String
) -> Result<&Self::OutputBorrowed, Error<Self::ProcessError>>
fn try_append_to_std_string(
self,
buf: &mut String
) -> Result<&Self::OutputBorrowed, Error<Self::ProcessError>>
Provided Methods
fn append_to_std_string(
self,
buf: &mut String
) -> Result<&Self::OutputBorrowed, Self::ProcessError>
fn append_to_std_string(
self,
buf: &mut String
) -> Result<&Self::OutputBorrowed, Self::ProcessError>
Processes the data, and appends it to the buffer inside the provided String.
Failures
This fails if failed to process data.
Panics
This panics if failed to allocate memory.
To avoid panic on allocation failure, use try_append_to_std_string.