pub enum FileContent<'a> {
Slice(&'a [u8]),
Buffer(Vec<u8>),
Owned(Box<dyn AsRef<[u8]> + 'a>),
}
Expand description
The raw content of a file.
This enum enables returning the raw bytes of a file in the most efficient representation.
Variants§
Slice(&'a [u8])
The content of the file as a borrowed byte slice.
Buffer(Vec<u8>)
The content of the file as an owned buffer.
Owned(Box<dyn AsRef<[u8]> + 'a>)
The content of the file as an owned value that contains bytes.
Implementations§
§impl<'a> FileContent<'a>
impl<'a> FileContent<'a>
pub fn from_owned(x: impl AsRef<[u8]> + 'a) -> FileContent<'a>
pub fn from_owned(x: impl AsRef<[u8]> + 'a) -> FileContent<'a>
Creates a FileContent
from an owned value that contains bytes.
Trait Implementations§
§impl AsRef<[u8]> for FileContent<'_>
impl AsRef<[u8]> for FileContent<'_>
§impl Debug for FileContent<'_>
impl Debug for FileContent<'_>
§impl<'a> From<&'a [u8]> for FileContent<'a>
impl<'a> From<&'a [u8]> for FileContent<'a>
§fn from(slice: &'a [u8]) -> FileContent<'a>
fn from(slice: &'a [u8]) -> FileContent<'a>
Converts to this type from the input type.
§impl From<Vec<u8>> for FileContent<'_>
impl From<Vec<u8>> for FileContent<'_>
§fn from(buffer: Vec<u8>) -> FileContent<'_>
fn from(buffer: Vec<u8>) -> FileContent<'_>
Converts to this type from the input type.
Auto Trait Implementations§
impl<'a> Freeze for FileContent<'a>
impl<'a> !RefUnwindSafe for FileContent<'a>
impl<'a> !Send for FileContent<'a>
impl<'a> !Sync for FileContent<'a>
impl<'a> Unpin for FileContent<'a>
impl<'a> !UnwindSafe for FileContent<'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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more