pub trait Archive: Sized {
type Error;
type Payload<'a>: MemberPayload<Error = Self::Error>
where Self: 'a;
// Required method
async fn next_member<'a>(
&'a mut self,
) -> Result<Option<Member<Self::Payload<'a>>>, Self::Error>;
// Provided methods
fn members(self) -> Members<Self> { ... }
async fn extract_in<P>(
self,
destination: P,
policy: ExtractPolicy,
) -> Result<(), ExtractError<Self::Error>>
where P: AsRef<Path> { ... }
}Expand description
A one-pass archive that can enumerate and extract format-neutral members.
Required Associated Types§
Sourcetype Payload<'a>: MemberPayload<Error = Self::Error>
where
Self: 'a
type Payload<'a>: MemberPayload<Error = Self::Error> where Self: 'a
The streaming payload type lent by each file member.
Required Methods§
Sourceasync fn next_member<'a>(
&'a mut self,
) -> Result<Option<Member<Self::Payload<'a>>>, Self::Error>
async fn next_member<'a>( &'a mut self, ) -> Result<Option<Member<Self::Payload<'a>>>, Self::Error>
Reads the next format-neutral member for Members::next.
Implementations must drain and validate an unfinished preceding payload
before returning another member. Archive consumers should use
Archive::members rather than call this hook directly: Members
wraps each payload in LentPayload to enforce the lending cursor
contract even when a concrete payload type does not retain its lifetime.
Provided Methods§
Sourceasync fn extract_in<P>(
self,
destination: P,
policy: ExtractPolicy,
) -> Result<(), ExtractError<Self::Error>>
async fn extract_in<P>( self, destination: P, policy: ExtractPolicy, ) -> Result<(), ExtractError<Self::Error>>
Securely extracts this archive beneath destination under policy.
destination is created if it does not already exist. Symbolic links
are preserved by default on platforms that support native creation;
hard links require explicit opt-in through extract::LinkPolicy.
Archived Unix permission modes are normalized rather than restored. New
regular files are created with mode 0o777 when executable intent is
set and 0o666 otherwise, in both cases filtered by the process umask.
Directories use the platform’s default creation mode, and special mode
bits are not restored. Ownership and timestamps are likewise determined
by extraction activity rather than archived metadata.
IMPORTANT: destination must not be concurrently modified during
extraction. No correctness or isolation guarantees are made under
external mutation.
Extraction is streamwise: a late error can leave a partially extracted destination. Callers requiring all-or-nothing behavior should extract into a new temporary directory and atomically rename it afterward.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".