pub enum DerivativeFormat {
Jxl,
Avif,
WebP,
Original,
}Expand description
The closed set of committed still-derivative formats — the tier table’s format column.
The wire value is mime, carried in DerivativeManifest.format. A value
outside this set is a structural rejection, never a “future format to ignore”.
Variants§
Jxl
JPEG XL — the committed primary/master still codec. Encodable, lossy, only under
the opt-in media-linked-codecs feature: libjxl is the one JXL encoder rawshift-image
has, and it is a C++ build the pure-Rust builds do not carry.
Avif
AVIF — the universal delivery format for clients without a JXL decoder. Encodable in every build, through gamut’s pure-Rust AV1 intra encoder.
WebP
WebP — the last-resort delivery fallback. Not encodable in this build: the crate’s
WebP encoder is not enabled — see media::StillFormat::WebP, which cannot be linked from
here because media is feature-gated and this module is not.
Original
The recognised format = "original" sentinel: the tier references the original asset
rather than generating a redundant derivative, because the source is not larger than the
tier’s cap. Distinct from an absent derivative — this is an explicit, signed marker,
where absence means “rebuildable from the original”.
A sentinel derivative carries no bytes of its own (media::GeneratedDerivative::bytes
is empty). “References” is the operative word in the contract: the signed manifest’s
ciphertext_hash content-addresses the original, which the holder already has, so
copying the bytes under a thumbnail’s name would duplicate a file sitting two directories
up and re-expose the original’s EXIF — GPS included — as a derivative blob, where a
re-encoded thumbnail is metadata-free by construction.
Implementations§
Source§impl DerivativeFormat
impl DerivativeFormat
Sourcepub const STILL_DELIVERY_ORDER: [Self; 3]
pub const STILL_DELIVERY_ORDER: [Self; 3]
The committed still formats per tier, in delivery-preference order: the JXL master, then the AVIF -> WebP delivery variants.
Sourcepub const fn extension(self) -> Option<&'static str>
pub const fn extension(self) -> Option<&'static str>
The on-disk file extension for a persisted derivative of this format. Original has
none of its own — it reuses the source asset’s.
Sourcepub fn parse(s: &str) -> Option<Self>
pub fn parse(s: &str) -> Option<Self>
Parse a DerivativeManifest.format value against the closed set. None is the
structural rejection.
Sourcepub fn is_recognized(s: &str) -> bool
pub fn is_recognized(s: &str) -> bool
Whether a format string names a currently-recognised still-derivative format — the
exact check a receiver runs.
Sourcepub const fn is_encodable(self) -> bool
pub const fn is_encodable(self) -> bool
Whether this build can produce bytes in this format.
Feature-dependent on purpose: the answer is about this build, and the JXL encoder is
linked only by media-linked-codecs. The mobile FFI and the rust-cross targets build
without it, and there JXL is a recorded per-(tier, format) deferral rather than a gap.
Trait Implementations§
Source§impl Clone for DerivativeFormat
impl Clone for DerivativeFormat
Source§fn clone(&self) -> DerivativeFormat
fn clone(&self) -> DerivativeFormat
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 DerivativeFormat
Source§impl Debug for DerivativeFormat
impl Debug for DerivativeFormat
Source§impl Display for DerivativeFormat
impl Display for DerivativeFormat
impl Eq for DerivativeFormat
Source§impl Hash for DerivativeFormat
impl Hash for DerivativeFormat
Source§impl PartialEq for DerivativeFormat
impl PartialEq for DerivativeFormat
Source§fn eq(&self, other: &DerivativeFormat) -> bool
fn eq(&self, other: &DerivativeFormat) -> bool
self and other values to be equal, and is used by ==.impl StructuralPartialEq for DerivativeFormat
Auto Trait Implementations§
impl Freeze for DerivativeFormat
impl RefUnwindSafe for DerivativeFormat
impl Send for DerivativeFormat
impl Sync for DerivativeFormat
impl Unpin for DerivativeFormat
impl UnsafeUnpin for DerivativeFormat
impl UnwindSafe for DerivativeFormat
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
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,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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>
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>
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