pub enum MemOrFile<M, F> {
Mem(M),
File(F),
}
Expand description
This is a general purpose Either, just like Result, except that the two cases are Mem for something that is in memory, and File for something that is somewhere external and only available via io.
Variants§
Implementations§
Source§impl<M, F> MemOrFile<M, (F, u64)>
impl<M, F> MemOrFile<M, (F, u64)>
Helper methods for a common way to use MemOrFile, where the memory part is something like a slice, and the file part is a tuple consisiting of path or file and size.
Source§impl<M, F> MemOrFile<M, F>
impl<M, F> MemOrFile<M, F>
Sourcepub fn as_ref(&self) -> MemOrFile<&M, &F>
pub fn as_ref(&self) -> MemOrFile<&M, &F>
Turn a reference to a MemOrFile into a MemOrFile of references
Sourcepub fn map_file<F2>(self, f: impl FnOnce(F) -> F2) -> MemOrFile<M, F2>
pub fn map_file<F2>(self, f: impl FnOnce(F) -> F2) -> MemOrFile<M, F2>
Map the file part of this MemOrFile
Trait Implementations§
Source§impl<'de, M, F> Deserialize<'de> for MemOrFile<M, F>where
M: Deserialize<'de>,
F: Deserialize<'de>,
impl<'de, M, F> Deserialize<'de> for MemOrFile<M, F>where
M: Deserialize<'de>,
F: Deserialize<'de>,
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl ReadAt for MemOrFile<Bytes, File>
impl ReadAt for MemOrFile<Bytes, File>
impl<M: Eq, F: Eq> Eq for MemOrFile<M, F>
impl<M, F> StructuralPartialEq for MemOrFile<M, F>
Auto Trait Implementations§
impl<M, F> Freeze for MemOrFile<M, F>
impl<M, F> RefUnwindSafe for MemOrFile<M, F>where
M: RefUnwindSafe,
F: RefUnwindSafe,
impl<M, F> Send for MemOrFile<M, F>
impl<M, F> Sync for MemOrFile<M, F>
impl<M, F> Unpin for MemOrFile<M, F>
impl<M, F> UnwindSafe for MemOrFile<M, F>where
M: UnwindSafe,
F: UnwindSafe,
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. 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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<R> ReadBytesAtExt for Rwhere
R: ReadAt,
impl<R> ReadBytesAtExt for Rwhere
R: ReadAt,
Source§fn read_u8_at(&self, pos: u64) -> Result<u8, Error>
fn read_u8_at(&self, pos: u64) -> Result<u8, Error>
Reads an unsigned 8-bit integer at an offset.
Source§fn read_i8_at(&self, pos: u64) -> Result<i8, Error>
fn read_i8_at(&self, pos: u64) -> Result<i8, Error>
Reads a signed 8-bit integer at an offset.
Source§fn read_u16_at<T>(&self, pos: u64) -> Result<u16, Error>where
T: ByteOrder,
fn read_u16_at<T>(&self, pos: u64) -> Result<u16, Error>where
T: ByteOrder,
Reads an unsigned 16-bit integer at an offset.
Source§fn read_i16_at<T>(&self, pos: u64) -> Result<i16, Error>where
T: ByteOrder,
fn read_i16_at<T>(&self, pos: u64) -> Result<i16, Error>where
T: ByteOrder,
Reads a signed 16-bit integer at an offset.
Source§fn read_u32_at<T>(&self, pos: u64) -> Result<u32, Error>where
T: ByteOrder,
fn read_u32_at<T>(&self, pos: u64) -> Result<u32, Error>where
T: ByteOrder,
Reads an unsigned 32-bit integer at an offset.
Source§fn read_i32_at<T>(&self, pos: u64) -> Result<i32, Error>where
T: ByteOrder,
fn read_i32_at<T>(&self, pos: u64) -> Result<i32, Error>where
T: ByteOrder,
Reads a signed 32-bit integer at an offset.
Source§fn read_u64_at<T>(&self, pos: u64) -> Result<u64, Error>where
T: ByteOrder,
fn read_u64_at<T>(&self, pos: u64) -> Result<u64, Error>where
T: ByteOrder,
Reads an unsigned 64-bit integer at an offset.
Source§fn read_i64_at<T>(&self, pos: u64) -> Result<i64, Error>where
T: ByteOrder,
fn read_i64_at<T>(&self, pos: u64) -> Result<i64, Error>where
T: ByteOrder,
Reads a signed 64-bit integer at an offset.
Source§fn read_uint_at<T>(&self, pos: u64, nbytes: usize) -> Result<u64, Error>where
T: ByteOrder,
fn read_uint_at<T>(&self, pos: u64, nbytes: usize) -> Result<u64, Error>where
T: ByteOrder,
Reads an unsigned
nbytes
-bit integer at an offset.Source§fn read_int_at<T>(&self, pos: u64, nbytes: usize) -> Result<i64, Error>where
T: ByteOrder,
fn read_int_at<T>(&self, pos: u64, nbytes: usize) -> Result<i64, Error>where
T: ByteOrder,
Reads a signed
nbytes
-bit integer at an offset.