#[non_exhaustive]pub struct ParseOptions { /* private fields */ }
Expand description
Options to control how Lofty parses a file
Implementations§
Source§impl ParseOptions
impl ParseOptions
Sourcepub const DEFAULT_PARSING_MODE: ParsingMode = ParsingMode::BestAttempt
pub const DEFAULT_PARSING_MODE: ParsingMode = ParsingMode::BestAttempt
Default parsing mode
Sourcepub const DEFAULT_MAX_JUNK_BYTES: usize = 1_024usize
pub const DEFAULT_MAX_JUNK_BYTES: usize = 1_024usize
Default number of junk bytes to read
Sourcepub const fn new() -> Self
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();
Sourcepub fn read_properties(&mut self, read_properties: bool) -> Self
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);
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);
Sourcepub fn parsing_mode(&mut self, parsing_mode: ParsingMode) -> Self
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);
Sourcepub fn max_junk_bytes(&mut self, max_junk_bytes: usize) -> Self
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);
Sourcepub fn read_cover_art(&mut self, read_cover_art: bool) -> Self
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);
Sourcepub fn implicit_conversions(&mut self, implicit_conversions: bool) -> Self
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
, andTIME
frames into a singleTDRC
frame
Examples of what this does not include:
- Converting a Vorbis
COVERART
field toMETADATA_BLOCK_PICTURE
- This is a non-standard field, with a well-defined conversion. Lofty will not support
the non-standard
COVERART
forPicture
s.
- This is a non-standard field, with a well-defined conversion. Lofty will not support
the non-standard
Trait Implementations§
Source§impl Clone for ParseOptions
impl Clone for ParseOptions
Source§fn clone(&self) -> ParseOptions
fn clone(&self) -> ParseOptions
1.0.0 · Source§const fn clone_from(&mut self, source: &Self)
const fn clone_from(&mut self, source: &Self)
source
. Read more