Struct async_fetcher::FetchedState
source · pub struct FetchedState {
pub future: Box<dyn Future<Item = Option<Option<FileTime>>, Error = FetchError> + Send>,
pub download_location: Arc<Path>,
pub final_destination: Arc<Path>,
/* private fields */
}
Expand description
This state manages renaming to the destination, and setting the timestamp of the fetched file.
Fields
future: Box<dyn Future<Item = Option<Option<FileTime>>, Error = FetchError> + Send>
download_location: Arc<Path>
final_destination: Arc<Path>
Implementations
sourceimpl FetchedState
impl FetchedState
sourcepub fn with_checksum<H: Digest>(self, checksum: Arc<str>) -> Self
pub fn with_checksum<H: Digest>(self, checksum: Arc<str>) -> Self
Apply a Digest
-able hash method to the downloaded file, and compare the checksum to the
given input.
sourcepub fn then_rename(
self
) -> CompletedState<impl Future<Item = (), Error = FetchError> + Send>
pub fn then_rename(
self
) -> CompletedState<impl Future<Item = (), Error = FetchError> + Send>
Replaces and renames the fetched file, then sets the file times.
sourcepub fn then_process<F>(
self,
construct_writer: F
) -> CompletedState<impl Future<Item = (), Error = FetchError> + Send>where
F: Fn(SyncFile) -> Result<Box<dyn Write + Send>> + Send,
pub fn then_process<F>(
self,
construct_writer: F
) -> CompletedState<impl Future<Item = (), Error = FetchError> + Send>where
F: Fn(SyncFile) -> Result<Box<dyn Write + Send>> + Send,
Processes the fetched file, storing the output to the destination, then setting the file times.
Use this to decompress an archive if the fetched file was an archive.
pub fn into_future(
self
) -> impl Future<Item = Option<Option<FileTime>>, Error = FetchError> + Send
Auto Trait Implementations
impl !RefUnwindSafe for FetchedState
impl Send for FetchedState
impl !Sync for FetchedState
impl Unpin for FetchedState
impl !UnwindSafe for FetchedState
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more