pub struct ConversionOptions {
pub from: Option<String>,
pub backend: Option<String>,
pub forced_plan: Option<Plan>,
pub params: BTreeMap<String, String>,
pub verify: bool,
pub reencode: bool,
pub preserve: Vec<String>,
pub inspect_content: bool,
}Expand description
Per-conversion identification and route-selection choices.
Defaults use file identification and normal planning without a backend filter
or quality params. Resource budgets are configured separately through
Converter::limits. All fields are public; construct with
ConversionOptions { field: value, ..ConversionOptions::default() }.
Fields§
§from: Option<String>Override format identification for every input (a format ID or extension).
Skips content identification, including its empty-file rejection. Staging still requires regular files within the per-file input budget. This is a caller assertion, not a content validation request.
backend: Option<String>Require every executed step to use this backend.
Normal planning first finds a bounded set of routes, then filters it; a matching route outside that set is not searched for. Identity plans have no steps and pass any backend filter. Forced plans are checked step by step.
forced_plan: Option<Plan>Skip route search and attempt only this caller-supplied plan.
Prefer a plan obtained from Converter::plan. Steps must have concrete
format IDs. Execution checks kind gates, the external flag against
Policy::allow_external, backend filtering, format continuity, and
returned artifacts. It does not verify edge membership in the graph,
recompute cost, enforce search budgets or decode-only gates, or apply
Policy::allow_external_packaging. Metadata is trusted: forced plans
are not a safe boundary for untrusted callers.
params: BTreeMap<String, String>Quality knobs forwarded verbatim to every executed step.
The reserved key quality carries a 0-100 integer string; the engine
validates that range and adapters map it onto their closest encoder
control (JPEG/WebP quality, ffmpeg -q, imageMagick -quality).
Unknown keys are ignored by adapters, so passing knobs for a backend
that is not selected is harmless. Params never select paths or tools:
values are opaque strings and are never interpolated into argv as
executable or filesystem locations.
verify: boolRe-sniff every step’s artifacts by content magic before accepting them.
When enabled, the engine reads the first bytes of each returned file and compares the detected format with the step target. A contradiction fails the route and the engine falls back to the next plan. Bytes with no known signature are accepted, because absence of evidence is not evidence of a mismatch. Disabled by default because detection only covers formats with registered signatures.
reencode: boolRequest a genuine re-encode when source and target formats match.
By default a same-format request stages a byte-for-byte copy with an
empty plan. When set, planning searches for nonempty routes that return
to the requested format (image recompression, codec change inside a
container) and the identity copy is not offered. If no re-encode route
exists with the registered adapters, conversion fails with an explanatory
Error::Invalid rather than silently copying.
preserve: Vec<String>Content properties every executed step must declare it preserves.
Names are adapter vocabulary (pixels, alpha, metadata, structure,
…), matched case-insensitively against crate::Conversion::retained during
planning and enforced again for forced plans at execution. An empty list
(the default) adds no requirement. The zero-step identity copy satisfies
any retention request because it preserves bytes.
inspect_content: boolAsk adapters to inspect this input’s content before planning.
When set (and no Self::from override is given), Converter::convert
profiles the first identified input through Converter::profile and
searches with Graph::routes_with_profile,
so edges with crate::Conversion::requires content are gated on the
observed streams. With an override, format identification (and any
inspection) is the caller’s job and no profile is taken. The converter’s
Policy::inspect_content sets the same behavior for every request;
this field overrides it per call.
Trait Implementations§
Source§impl Clone for ConversionOptions
impl Clone for ConversionOptions
Source§impl Debug for ConversionOptions
impl Debug for ConversionOptions
Auto Trait Implementations§
impl Forget for ConversionOptions
impl Freeze for ConversionOptions
impl RefUnwindSafe for ConversionOptions
impl Send for ConversionOptions
impl Sync for ConversionOptions
impl Unpin for ConversionOptions
impl UnsafeUnpin for ConversionOptions
impl UnwindSafe for ConversionOptions
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,
Source§impl<F, T> IntoSample<T> for Fwhere
T: FromSample<F>,
impl<F, T> IntoSample<T> for Fwhere
T: FromSample<F>,
fn into_sample(self) -> T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
ReadEndian::read_from_little_endian().