Skip to main content

Conversion

Struct Conversion 

Source
#[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
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.
§from: String

Source format ID, or * for a wildcard accepted by Graph::add_conversion.

§to: String

Target format ID.

§backend: String

Adapter name.

§operation: String

Adapter operation ID.

§kind: ConversionKind

Semantic conversion classification.

§cost: u32

Positive relative route cost; lower sums are preferred, not measured runtime.

§external: bool

True 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: ConversionCategory

Whether 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

Source

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.

Source

pub fn requires_external(self) -> Conversion

Flag this edge as requiring an out-of-process native tool.

Source

pub fn with_note(self, note: &str) -> Conversion

Attach an adapter-supplied cost or fidelity note; see Self::note.

Source

pub fn with_kind(self, kind: ConversionKind) -> Conversion

Override the semantic conversion classification given at construction.

Source

pub fn with_cost(self, cost: u32) -> Conversion

Override the relative route cost given at construction.

Source

pub fn creative(self) -> Conversion

Mark this edge as a ConversionCategory::Creative operation.

Source

pub fn with_category(self, category: ConversionCategory) -> Conversion

Set the conversion category; see Self::category.

Source

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.

Source

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.

Source

pub fn requiring(self, content: &[ContentKind]) -> Conversion

Declare the content kinds this step needs in its source; see Self::requires.

Source

pub fn producing(self, content: &[ContentKind]) -> Conversion

Declare the content kinds this step places into its target; see Self::produces.

Source

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

Source§

fn clone(&self) -> Conversion

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 Debug for Conversion

Source§

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

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

impl Eq for Conversion

Source§

impl Ord for Conversion

Source§

fn cmp(&self, other: &Conversion) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 (const: unstable) · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 (const: unstable) · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 (const: unstable) · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

fn clamp_to<R>(self, range: R) -> Self
where Self: Sized, R: ClampBounds<Self>,

🔬This is a nightly-only experimental API. (clamp_to)
Restrict a value to a certain range. Read more
Source§

impl PartialEq for Conversion

Source§

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

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

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

Inequality operator !=. Read more
Source§

impl PartialOrd for Conversion

Source§

fn partial_cmp(&self, other: &Conversion) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 (const: unstable) · Source§

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

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 (const: unstable) · Source§

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

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 (const: unstable) · Source§

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

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 (const: unstable) · Source§

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

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl StructuralPartialEq for Conversion

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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<Q, K> Comparable<K> for Q
where Q: Ord + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn compare(&self, key: &K) -> Ordering

Compare self to key and return their ordering.
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
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<F, T> IntoSample<T> for F
where T: FromSample<F>,

Source§

fn into_sample(self) -> T

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

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 = !

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

fn try_from(value: U) -> Result<T, !>

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.