Enum Target

Source
pub enum Target {
    Mp3,
    Opus,
    Aac,
    Vorbis,
    Flac,
    Wav,
}
Expand description

A format a copy can be converted into.

Deliberately short. Every entry here is a format a portable player is likely to want, and each one costs a decoder somebody has to have: adding a target nobody asked for is a promise to keep it working.

Variants§

§

Mp3

The one every device plays.

§

Opus

Best quality per byte at low bitrates, and what a modern player wants.

§

Aac

What Apple devices prefer, in an MP4 container.

§

Vorbis

The free lossy format Ogg carries.

§

Flac

Lossless, and much smaller than WAV: the reason to convert a WAV rip.

§

Wav

Uncompressed, for a device that plays nothing else.

Implementations§

Source§

impl Target

Source

pub fn parse(word: &str) -> Option<Target>

The target a typed word names, or None for a word that names none.

Source

pub fn names() -> String

Every spelling accepted, for a message that offers what it refuses.

Source

pub fn lossy_names() -> String

The targets that have a quality setting at all.

Read from the same table as everything else, so a format added tomorrow appears here without anybody remembering to add it — which is the whole reason the table exists.

Source

pub fn quality_forms(self) -> &'static str

Accepted quality settings for this encoder, for actionable refusals.

Source

pub fn extension(self) -> &'static str

The file extension a converted file carries, without its dot.

Source

pub fn lossless(self) -> bool

true when the target keeps every sample it was given.

Source

pub fn keeps_embedded_art(self) -> bool

Whether a cover embedded in the source can travel into this target at all. false here is not this code declining to carry it — ffmpeg itself refuses to mux a picture stream into wav, opus or vorbis (verified directly: mapping a video stream into any of the three fails outright and produces no file), so the loss happens at the encoder whatever is asked of it. convert reads this same rule, once.

Source

pub fn tags_it_would_drop( self, present: &BTreeMap<String, Vec<String>>, ) -> Vec<String>

Canonical tag keys present holds that this target is known to drop.

Empty for every target but wav, and empty for wav too when nothing present falls outside its vocabulary — a file tagged with only title, artist and album loses nothing by becoming a WAV.

Trait Implementations§

Source§

impl Clone for Target

Source§

fn clone(&self) -> Target

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for Target

Source§

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

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

impl PartialEq for Target

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Copy for Target

Source§

impl Eq for Target

Source§

impl StructuralPartialEq for Target

Auto Trait Implementations§

§

impl Freeze for Target

§

impl RefUnwindSafe for Target

§

impl Send for Target

§

impl Sync for Target

§

impl Unpin for Target

§

impl UnwindSafe for Target

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.

§

impl<S> FromSample<S> for S

§

fn from_sample_(s: S) -> S

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.

§

impl<F, T> IntoSample<T> for F
where T: FromSample<F>,

§

fn into_sample(self) -> T

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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
§

impl<T, U> ToSample<U> for T
where U: FromSample<T>,

§

fn to_sample_(self) -> U

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.
§

impl<S, T> Duplex<S> for T
where T: FromSample<S> + ToSample<S>,