Struct lofty::ParseOptions
source · #[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::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::ParseOptions;
// By default, `read_properties` is enabled. Here, we don't want to read them.
let parsing_options = ParseOptions::new().read_properties(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::{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::ParseOptions;
// I have files full of junk, I'll double the search window!
let parsing_options = ParseOptions::new().max_junk_bytes(2048);
Trait Implementations§
source§impl Clone for ParseOptions
impl Clone for ParseOptions
source§fn clone(&self) -> ParseOptions
fn clone(&self) -> ParseOptions
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for ParseOptions
impl Debug for ParseOptions
source§impl Default for ParseOptions
impl Default for ParseOptions
source§impl Ord for ParseOptions
impl Ord for ParseOptions
source§fn cmp(&self, other: &ParseOptions) -> Ordering
fn cmp(&self, other: &ParseOptions) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
source§impl PartialEq for ParseOptions
impl PartialEq for ParseOptions
source§fn eq(&self, other: &ParseOptions) -> bool
fn eq(&self, other: &ParseOptions) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.source§impl PartialOrd for ParseOptions
impl PartialOrd for ParseOptions
source§fn partial_cmp(&self, other: &ParseOptions) -> Option<Ordering>
fn partial_cmp(&self, other: &ParseOptions) -> Option<Ordering>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read moreimpl Copy for ParseOptions
impl Eq for ParseOptions
impl StructuralEq for ParseOptions
impl StructuralPartialEq for ParseOptions
Auto Trait Implementations§
impl RefUnwindSafe for ParseOptions
impl Send for ParseOptions
impl Sync for ParseOptions
impl Unpin for ParseOptions
impl UnwindSafe for ParseOptions
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