#[non_exhaustive]pub struct Conversion {
pub from: String,
pub to: String,
pub backend: String,
pub operation: String,
pub kind: ConversionKind,
pub cost: u32,
pub external: bool,
pub note: Option<String>,
pub category: ConversionCategory,
pub retained: Vec<String>,
pub requires: Vec<ContentKind>,
pub produces: Vec<ContentKind>,
}Expand description
A directed conversion edge supplied by an adapter.
Backend and operation IDs are opaque to the planner. They do not select codecs, quality settings, or other encoder parameters in this crate.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.from: StringSource format ID, or * for a wildcard accepted by Graph::add_conversion.
to: StringTarget format ID.
backend: StringAdapter name.
operation: StringAdapter operation ID.
kind: ConversionKindSemantic conversion classification.
cost: u32Positive relative route cost; lower sums are preferred, not measured runtime.
external: boolTrue when executing this step spawns an out-of-process native tool.
note: Option<String>Adapter-supplied, human-readable cost or fidelity note.
The planner ignores this value. It exists so Graph::routes consumers
(and execution reports) can explain what an edge costs or discards.
category: ConversionCategoryWhether this edge performs conventional work or generates an expressive
representation; see ConversionCategory and Policy::allow_creative.
retained: Vec<String>Content properties this step preserves, as declared by its adapter.
Entries are normalized property names (see Conversion::with_retained).
When Policy::retain names properties, search only walks edges whose
retained set covers every requested property. This is an adapter claim,
not a planner-verified guarantee; see the crate-level fidelity notes.
requires: Vec<ContentKind>Content kinds this step needs inside its source representation.
A subtitle extractor from mp4 declares [{ video }, { text }]-style
requirements; a plain format edge declares none. Under
Graph::routes_with_profile, an edge leaving the profiled source
format is usable only when its requirements are satisfied by the
observed ContentProfile (or, with no profile, by the source format’s
declared Format::payloads when it is empty or Policy::require_content
is off). Requirements never block edges that leave another format: only
the profiled source and the final target are checked against content.
produces: Vec<ContentKind>Content kinds this step places into its target representation.
The target end of a route is matched against Policy::require, using
the observed profile when one exists or Format::payloads otherwise.
The planner never infers produced kinds from other graph structure.
Implementations§
Source§impl Conversion
impl Conversion
Sourcepub fn new(
from: &str,
to: &str,
backend: &str,
operation: &str,
kind: ConversionKind,
cost: u32,
) -> Conversion
pub fn new( from: &str, to: &str, backend: &str, operation: &str, kind: ConversionKind, cost: u32, ) -> Conversion
Construct an edge with Self::external set to false and no note.
Values are copied without validation. Graph::add_conversion checks
endpoint registration, positive cost, and nonblank backend and operation.
Sourcepub fn requires_external(self) -> Conversion
pub fn requires_external(self) -> Conversion
Flag this edge as requiring an out-of-process native tool.
Sourcepub fn with_note(self, note: &str) -> Conversion
pub fn with_note(self, note: &str) -> Conversion
Attach an adapter-supplied cost or fidelity note; see Self::note.
Sourcepub fn with_kind(self, kind: ConversionKind) -> Conversion
pub fn with_kind(self, kind: ConversionKind) -> Conversion
Override the semantic conversion classification given at construction.
Sourcepub fn with_cost(self, cost: u32) -> Conversion
pub fn with_cost(self, cost: u32) -> Conversion
Override the relative route cost given at construction.
Sourcepub fn creative(self) -> Conversion
pub fn creative(self) -> Conversion
Mark this edge as a ConversionCategory::Creative operation.
Sourcepub fn with_category(self, category: ConversionCategory) -> Conversion
pub fn with_category(self, category: ConversionCategory) -> Conversion
Set the conversion category; see Self::category.
Sourcepub fn with_retained(self, properties: &[&str]) -> Conversion
pub fn with_retained(self, properties: &[&str]) -> Conversion
Declare the content properties this step preserves; see Self::retained.
Values are trimmed and lowercased, then sorted and deduplicated. An edge that declares no properties preserves nothing it is asked to retain.
Sourcepub fn retains_all(&self, required: &[&str]) -> bool
pub fn retains_all(&self, required: &[&str]) -> bool
Whether this step preserves every property named in required.
An empty or whitespace-only entry in required is ignored, matching the
normalization applied to declared properties.
Sourcepub fn requiring(self, content: &[ContentKind]) -> Conversion
pub fn requiring(self, content: &[ContentKind]) -> Conversion
Declare the content kinds this step needs in its source; see
Self::requires.
Sourcepub fn producing(self, content: &[ContentKind]) -> Conversion
pub fn producing(self, content: &[ContentKind]) -> Conversion
Declare the content kinds this step places into its target; see
Self::produces.
Sourcepub fn content_satisfies(
&self,
requirements: &[ContentKind],
profile: Option<&ContentProfile>,
payloads: &[ContentKind],
) -> bool
pub fn content_satisfies( &self, requirements: &[ContentKind], profile: Option<&ContentProfile>, payloads: &[ContentKind], ) -> bool
Whether this edge’s source content requirements are satisfied.
Returns true when requirements is empty. When a profile is supplied,
each requirement is matched against its streams; otherwise, each is
matched against payloads (the format’s declared contents). An edge
with requirements is never usable from a format that declares nothing
and has no observed profile.
Trait Implementations§
Source§impl Clone for Conversion
impl Clone for Conversion
Source§fn clone(&self) -> Conversion
fn clone(&self) -> Conversion
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 Conversion
impl Debug for Conversion
impl Eq for Conversion
Source§impl Ord for Conversion
impl Ord for Conversion
Source§fn cmp(&self, other: &Conversion) -> Ordering
fn cmp(&self, other: &Conversion) -> Ordering
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialEq for Conversion
impl PartialEq for Conversion
Source§impl PartialOrd for Conversion
impl PartialOrd for Conversion
impl StructuralPartialEq for Conversion
Auto Trait Implementations§
impl Forget for Conversion
impl Freeze for Conversion
impl RefUnwindSafe for Conversion
impl Send for Conversion
impl Sync for Conversion
impl Unpin for Conversion
impl UnsafeUnpin for Conversion
impl UnwindSafe for Conversion
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<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
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.