pub enum CloneCapability {
None,
WholeFile,
Range,
}Expand description
What kind of zero-copy extent sharing — reflinks — the backend
can express. Returned by Filesystem::clone_capability.
Reflinks let a destination file (or a range of it) point at the same physical extents as a source, with copy-on-write semantics on the next write to either side. The on-disk encoding differs per backend (XFS refcount-btree, APFS clone records, Btrfs shared extents), so the trait surface offers two operations and a capability gate, with sensible byte-copy fallbacks for backends that can’t share extents natively.
Variants§
None
No extent sharing. clone_file falls back to a stream-copy
(semantically equivalent, just not zero-copy); clone_range
returns crate::Error::Unsupported.
WholeFile
Whole-file clone only — the backend can share every extent
of the source into the destination as one atomic operation
(e.g. APFS file-clone records). Sub-file ranges aren’t
individually shareable, so clone_range still errors
Unsupported unless the range exactly covers the whole file.
Range
Arbitrary range clone — clone_range works for any allocation-
unit-aligned (src_off, dst_off, len) triple. XFS reflink,
Btrfs BTRFS_IOC_CLONE_RANGE, and FICLONERANGE in general.
Implementations§
Source§impl CloneCapability
impl CloneCapability
True for CloneCapability::WholeFile or CloneCapability::Range.
clone_file is guaranteed not to byte-copy in this case.
Sourcepub fn supports_range(self) -> bool
pub fn supports_range(self) -> bool
True only for CloneCapability::Range — i.e. sub-file
clone_range calls will succeed (assuming alignment etc.).
Trait Implementations§
Source§impl Clone for CloneCapability
impl Clone for CloneCapability
Source§fn clone(&self) -> CloneCapability
fn clone(&self) -> CloneCapability
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for CloneCapability
impl Debug for CloneCapability
Source§impl PartialEq for CloneCapability
impl PartialEq for CloneCapability
Source§fn eq(&self, other: &CloneCapability) -> bool
fn eq(&self, other: &CloneCapability) -> bool
self and other values to be equal, and is used by ==.