pub struct ResumeState { /* private fields */ }Expand description
On-disk resume state for one file.
Implementations§
Source§impl ResumeState
impl ResumeState
pub fn state_path(final_path: &Path) -> PathBuf
Sourcepub fn load_or_new(final_path: &Path, size: u64, chunk_size: u32) -> Self
pub fn load_or_new(final_path: &Path, size: u64, chunk_size: u32) -> Self
Load existing state, or start empty.
Any mismatch — different size, different chunk size, a truncated or corrupt file — is treated as “no state”, which costs a retransfer and never risks a corrupt result.
pub fn bitmap(&self) -> &ChunkBitmap
pub fn has(&self, chunk: u64) -> bool
pub fn pending(&self) -> u64
pub fn is_complete(&self) -> bool
Sourcepub fn checkpoint(&mut self, handle: &WriteHandle) -> Result<()>
pub fn checkpoint(&mut self, handle: &WriteHandle) -> Result<()>
Flush data, then persist the bitmap. Never the other way round.
Auto Trait Implementations§
impl Freeze for ResumeState
impl RefUnwindSafe for ResumeState
impl Send for ResumeState
impl Sync for ResumeState
impl Unpin for ResumeState
impl UnsafeUnpin for ResumeState
impl UnwindSafe for ResumeState
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
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> ⓘ
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