pub struct SkipPolicy(/* private fields */);Expand description
A batch-level compression policy: one ContentHint covering everything in
a run, plus the fallbacks for when the hint says nothing.
Batch-level because that is how the knowledge actually arrives — a caller sealing a pack knows it for the whole pack, not entry by entry.
The two decision points are deliberately split, because the compress path has two moments with different information available:
skip_by_pathruns during enumeration, before a single byte is read;skip_by_bytesrefines it inside the compressor, once a chunk’s real bytes are in hand, and isldeflate::precompressed::SkipPolicy::skipunder a name that says which of the two moments it belongs to.
Implementations§
Source§impl SkipPolicy
impl SkipPolicy
Sourcepub const fn already_compressed() -> Self
pub const fn already_compressed() -> Self
Everything in this batch is already compressed — store it all raw.
Sourcepub const fn compress_everything() -> Self
pub const fn compress_everything() -> Self
Compress everything, whatever it looks like. The meaning of --no-skip.
Sourcepub const fn from_no_skip(no_skip: bool) -> Self
pub const fn from_no_skip(no_skip: bool) -> Self
Bridge from the historical no_skip: bool, which is precisely the
two-valued subset of ContentHint that the CLI already exposed.
pub const fn from_hint(hint: ContentHint) -> Self
pub const fn hint(&self) -> ContentHint
Sourcepub const fn as_ldeflate(&self) -> SkipPolicy
pub const fn as_ldeflate(&self) -> SkipPolicy
The same policy as ldeflate sees it — for a caller handing bytes
straight to ldeflate::compress_objects rather than to znippy’s packer,
so the two cannot disagree about what a hint means.
Sourcepub fn skip_by_path(&self, path: &Path) -> bool
pub fn skip_by_path(&self, path: &Path) -> bool
The decision available before any bytes are read: hint, else the extension table.
This is the leg ldeflate cannot have — it is handed &[u8], never a
Path.
true means “store raw”. A false here is not final — the caller
should still offer the bytes to skip_by_bytes
once it has them.
Sourcepub fn skip_by_bytes(&self, prefix: &[u8]) -> bool
pub fn skip_by_bytes(&self, prefix: &[u8]) -> bool
The refinement once real bytes are in hand: a magic-byte probe.
Only meaningful when skip_by_path returned
false; calling it otherwise is harmless but pointless. Honours the hint
in both directions, so a Compressible batch is never vetoed by a probe.
Trait Implementations§
Source§impl Clone for SkipPolicy
impl Clone for SkipPolicy
Source§fn clone(&self) -> SkipPolicy
fn clone(&self) -> SkipPolicy
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for SkipPolicy
Source§impl Debug for SkipPolicy
impl Debug for SkipPolicy
Source§impl Default for SkipPolicy
impl Default for SkipPolicy
Source§fn default() -> SkipPolicy
fn default() -> SkipPolicy
impl Eq for SkipPolicy
Source§impl From<SkipPolicy> for SkipPolicy
impl From<SkipPolicy> for SkipPolicy
Source§fn from(p: SkipPolicy) -> Self
fn from(p: SkipPolicy) -> Self
Source§impl From<SkipPolicy> for SkipPolicy
impl From<SkipPolicy> for SkipPolicy
Source§fn from(p: SkipPolicy) -> Self
fn from(p: SkipPolicy) -> Self
Source§impl PartialEq for SkipPolicy
impl PartialEq for SkipPolicy
impl StructuralPartialEq for SkipPolicy
Auto Trait Implementations§
impl Freeze for SkipPolicy
impl RefUnwindSafe for SkipPolicy
impl Send for SkipPolicy
impl Sync for SkipPolicy
impl Unpin for SkipPolicy
impl UnsafeUnpin for SkipPolicy
impl UnwindSafe for SkipPolicy
Blanket Implementations§
impl<T> Allocation for T
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.