pub trait ResumeDataExt: Sized {
// Required methods
fn from_request_group(
group: &RequestGroup,
) -> impl Future<Output = Result<Self, String>> + Send;
fn to_restore_components(
&self,
) -> (String, Vec<String>, HashMap<String, String>, RestoreState);
}Expand description
Extension trait for converting between ResumeData and RequestGroup
Provides bidirectional conversion:
from_request_group(): Extract complete state from a live RequestGroupto_request_group(): Reconstruct a RequestGroup from persisted data
Required Methods§
Sourcefn from_request_group(
group: &RequestGroup,
) -> impl Future<Output = Result<Self, String>> + Send
fn from_request_group( group: &RequestGroup, ) -> impl Future<Output = Result<Self, String>> + Send
Create ResumeData from a RequestGroup (async, reads state)
Extracts all persistable state from the RequestGroup including:
- Identity: GID as hex string
- URIs: Full list with initial state tracking
- Progress: total/completed/uploaded lengths, speeds
- Status: Current lifecycle status as string
- Timing: Creation and last activity timestamps
- File info: Output path from options
- Checksum: Algorithm and expected value if configured
- Options: Relevant subset for restoration
- BT-specific: bitfield, info_hash, metadata path
- HTTP-specific: resume offset for range requests
§Arguments
group- Reference to the RequestGroup to extract state from
§Returns
Ok(ResumeData)- Fully populated resume dataErr(String)- Extraction error with context
Sourcefn to_restore_components(
&self,
) -> (String, Vec<String>, HashMap<String, String>, RestoreState)
fn to_restore_components( &self, ) -> (String, Vec<String>, HashMap<String, String>, RestoreState)
Convert ResumeData back to restorable state components
Deconstructs the ResumeData into components needed to reconstruct a RequestGroup for session restoration.
§Returns
Tuple of (gid_hex, uris, options_map, restore_state) where restore_state contains protocol-specific recovery data.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".