pub struct FactorySource<F> { /* private fields */ }Expand description
Adapts a reader-producing closure into a FileSource.
The closure is called whenever the receiving application requests a new stream. It must create an independent reader on every invocation.
Use a closure that implements Fn() -> io::Result<SourceReader> and is
Send + Sync.
Implementations§
Source§impl<F> FactorySource<F>
impl<F> FactorySource<F>
Sourcepub fn new(open: F) -> Self
pub fn new(open: F) -> Self
Creates a file source using the supplied reader factory.
The factory is evaluated lazily when FileSource::open is called,
rather than when this value is constructed.
Trait Implementations§
Source§impl<F> FileSource for FactorySource<F>
impl<F> FileSource for FactorySource<F>
Auto Trait Implementations§
impl<F> Freeze for FactorySource<F>where
F: Freeze,
impl<F> RefUnwindSafe for FactorySource<F>where
F: RefUnwindSafe,
impl<F> Send for FactorySource<F>where
F: Send,
impl<F> Sync for FactorySource<F>where
F: Sync,
impl<F> Unpin for FactorySource<F>where
F: Unpin,
impl<F> UnsafeUnpin for FactorySource<F>where
F: UnsafeUnpin,
impl<F> UnwindSafe for FactorySource<F>where
F: UnwindSafe,
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