pub enum FormatConversionResult<F> {
Direct(F),
Convert {
from: F,
to: F,
cost: u32,
},
Incompatible,
}Expand description
Result of a FormatNegotiator negotiation run.
Discriminates between a direct match (no conversion needed), a conversion with an associated cost ordinal, and a fully incompatible pair.
§Examples
use oximedia_core::codec_negotiation::{FormatNegotiator, FormatConversionResult};
use oximedia_core::types::PixelFormat;
let neg = FormatNegotiator::<PixelFormat> {
decoder_produces: &[PixelFormat::Yuv420p],
encoder_accepts: &[PixelFormat::Yuv420p],
};
assert_eq!(neg.negotiate(), FormatConversionResult::Direct(PixelFormat::Yuv420p));Variants§
Direct(F)
Encoder directly accepts what the decoder produces — no conversion needed.
Convert
A conversion is required. cost is an ordinal (0 = identity, higher =
more expensive).
Incompatible
No compatible conversion path exists.
Trait Implementations§
Source§impl<F: Clone> Clone for FormatConversionResult<F>
impl<F: Clone> Clone for FormatConversionResult<F>
Source§fn clone(&self) -> FormatConversionResult<F>
fn clone(&self) -> FormatConversionResult<F>
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<F: Debug> Debug for FormatConversionResult<F>
impl<F: Debug> Debug for FormatConversionResult<F>
Source§impl<F: PartialEq> PartialEq for FormatConversionResult<F>
impl<F: PartialEq> PartialEq for FormatConversionResult<F>
Source§fn eq(&self, other: &FormatConversionResult<F>) -> bool
fn eq(&self, other: &FormatConversionResult<F>) -> bool
Tests for
self and other values to be equal, and is used by ==.impl<F> StructuralPartialEq for FormatConversionResult<F>
Auto Trait Implementations§
impl<F> Freeze for FormatConversionResult<F>where
F: Freeze,
impl<F> RefUnwindSafe for FormatConversionResult<F>where
F: RefUnwindSafe,
impl<F> Send for FormatConversionResult<F>where
F: Send,
impl<F> Sync for FormatConversionResult<F>where
F: Sync,
impl<F> Unpin for FormatConversionResult<F>where
F: Unpin,
impl<F> UnsafeUnpin for FormatConversionResult<F>where
F: UnsafeUnpin,
impl<F> UnwindSafe for FormatConversionResult<F>where
F: UnwindSafe,
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
Mutably borrows from an owned value. Read more