Struct ParseOptions

Source
#[non_exhaustive]
pub struct ParseOptions { /* private fields */ }
Expand description

Options to control how Lofty parses a file

Implementations§

Source§

impl ParseOptions

Source

pub const DEFAULT_PARSING_MODE: ParsingMode = ParsingMode::BestAttempt

Default parsing mode

Source

pub const DEFAULT_MAX_JUNK_BYTES: usize = 1_024usize

Default number of junk bytes to read

Source

pub const fn new() -> Self

Creates a new ParseOptions, alias for Default implementation

See also: ParseOptions::default

§Examples
use lofty::config::ParseOptions;

let parsing_options = ParseOptions::new();
Source

pub fn read_properties(&mut self, read_properties: bool) -> Self

Whether or not to read the audio properties

§Examples
use lofty::config::ParseOptions;

// By default, `read_properties` is enabled. Here, we don't want to read them.
let parsing_options = ParseOptions::new().read_properties(false);
Source

pub fn read_tags(&mut self, read_tags: bool) -> Self

Whether or not to read the tags

§Examples
use lofty::config::ParseOptions;

// By default, `read_tags` is enabled. Here, we don't want to read them.
let parsing_options = ParseOptions::new().read_tags(false);
Source

pub fn parsing_mode(&mut self, parsing_mode: ParsingMode) -> Self

The parsing mode to use, see ParsingMode for details

§Examples
use lofty::config::{ParseOptions, ParsingMode};

// By default, `parsing_mode` is ParsingMode::BestAttempt. Here, we need absolute correctness.
let parsing_options = ParseOptions::new().parsing_mode(ParsingMode::Strict);
Source

pub fn max_junk_bytes(&mut self, max_junk_bytes: usize) -> Self

The maximum number of allowed junk bytes to search

Some information may be surrounded by junk bytes, such as tag padding remnants. This sets the maximum number of junk/unrecognized bytes Lofty will search for required information before giving up.

§Examples
use lofty::config::ParseOptions;

// I have files full of junk, I'll double the search window!
let parsing_options = ParseOptions::new().max_junk_bytes(2048);
Source

pub fn read_cover_art(&mut self, read_cover_art: bool) -> Self

Whether or not to read cover art

§Examples
use lofty::config::ParseOptions;

// Reading cover art is expensive, and I do not need it!
let parsing_options = ParseOptions::new().read_cover_art(false);
Source

pub fn implicit_conversions(&mut self, implicit_conversions: bool) -> Self

Whether or not to perform implicit conversions

Implicit conversions are conversions that are not explicitly defined by the spec, but are commonly used.

Warning

Turning this off may cause some Accessor methods to return nothing. Lofty makes some assumptions about the data, if they are broken, the caller will have more responsibility.

Examples include:

  • Converting the outdated MP4 gnre atom to a ©gen atom
  • Combining the ID3v2.3 TYER, TDAT, and TIME frames into a single TDRC frame

Examples of what this does not include:

  • Converting a Vorbis COVERART field to METADATA_BLOCK_PICTURE
    • This is a non-standard field, with a well-defined conversion. Lofty will not support the non-standard COVERART for Pictures.

Trait Implementations§

Source§

impl Clone for ParseOptions

Source§

fn clone(&self) -> ParseOptions

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

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

Performs copy-assignment from source. Read more
Source§

impl Debug for ParseOptions

Source§

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

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

impl Default for ParseOptions

Source§

fn default() -> Self

The default implementation for ParseOptions

The defaults are as follows:

ParseOptions {
	read_properties: true,
    read_tags: true,
	parsing_mode: ParsingMode::BestAttempt,
    max_junk_bytes: 1024,
    read_cover_art: true,
    implicit_conversions: true,
}
Source§

impl PartialEq for ParseOptions

Source§

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

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

const 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 ParseOptions

Source§

impl Eq for ParseOptions

Source§

impl StructuralPartialEq for ParseOptions

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

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