Enum iroh_blobs::util::MemOrFile
source · 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§
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