Skip to main content

MetadataFields

Struct MetadataFields 

Source
#[non_exhaustive]
pub struct MetadataFields { pub icc: IccRetention, pub exif: ExifPolicy, pub xmp: Retention, pub cicp: Retention, pub hdr: Retention, }
Expand description

Per-field metadata retention for MetadataPolicy::Custom.

EXIF is encapsulated in ExifPolicy (pruned by category); the remaining fields use Retention (explicit Keep/Discard). This type is #[non_exhaustive] (new fields can be added without a breaking change), so downstream crates build from KEEP_ALL / DISCARD_ALL via the with_* builders rather than struct-update syntax. Drop only GPS, keep all else:

use zencodec::{MetadataFields, exif::{ExifPolicy, Retention}};
let fields = MetadataFields::KEEP_ALL
    .with_exif(ExifPolicy::KEEP_ALL.with_gps(Retention::Discard));

Fields (Non-exhaustive)§

This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§icc: IccRetention

ICC color profile.

§exif: ExifPolicy

EXIF, pruned by category.

§xmp: Retention

XMP, whole-segment. The XMP packet (RDF/XML) can carry GPS (exif:GPS*), edit history (photoshop:History, xmpMM:History), and C2PA provenance (xmpMM manifests), so the presets that strip privacy/bloat (Web) discard it wholesale while keeping EXIF rights.

Partial XMP (e.g. keep dc:rights/dc:creator, drop GPS + history + C2PA) is a planned future addition — it needs an RDF/XML parser, so it is deferred rather than half-done. It will arrive as a new MetadataFields field (this struct is #[non_exhaustive], so adding one is non-breaking); xmp will remain the whole-segment master switch.

§cicp: Retention

CICP color signaling.

§hdr: Retention

HDR ContentLightLevel + MasteringDisplay.

Implementations§

Source§

impl MetadataFields

Source

pub const KEEP_ALL: Self

Keep every field (ICC kept as-is, including a redundant sRGB).

Source

pub const DISCARD_ALL: Self

Discard every field.

Source

pub const fn with_icc(self, r: IccRetention) -> Self

Set ICC retention. (Builder — this type is #[non_exhaustive].)

Source

pub const fn with_exif(self, p: ExifPolicy) -> Self

Set the EXIF retention policy.

Source

pub const fn with_xmp(self, r: Retention) -> Self

Set XMP retention.

Source

pub const fn with_cicp(self, r: Retention) -> Self

Set CICP retention.

Source

pub const fn with_hdr(self, r: Retention) -> Self

Set HDR (light-level/mastering) retention.

Trait Implementations§

Source§

impl Clone for MetadataFields

Source§

fn clone(&self) -> MetadataFields

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for MetadataFields

Source§

impl Debug for MetadataFields

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for MetadataFields

Source§

impl PartialEq for MetadataFields

Source§

fn eq(&self, other: &MetadataFields) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for MetadataFields

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.