Struct lofty::GlobalOptions
source · #[non_exhaustive]pub struct GlobalOptions { /* private fields */ }Expand description
Options that control all interactions with Lofty for the current thread
Examples
use lofty::GlobalOptions;
// I have a custom resolver that I need checked
let global_options = GlobalOptions::new().use_custom_resolvers(true);
lofty::apply_global_options(global_options);Implementations§
source§impl GlobalOptions
impl GlobalOptions
sourcepub const DEFAULT_ALLOCATION_LIMIT: usize = 16_777_216usize
pub const DEFAULT_ALLOCATION_LIMIT: usize = 16_777_216usize
Default allocation limit for any single tag item
sourcepub const fn new() -> Self
pub const fn new() -> Self
Creates a new GlobalOptions, alias for Default implementation
See also: GlobalOptions::default
Examples
use lofty::GlobalOptions;
let global_options = GlobalOptions::new();sourcepub fn use_custom_resolvers(&mut self, use_custom_resolvers: bool) -> Self
pub fn use_custom_resolvers(&mut self, use_custom_resolvers: bool) -> Self
Whether or not to check registered custom resolvers
See also: crate::resolve
Examples
use lofty::GlobalOptions;
// By default, `use_custom_resolvers` is enabled. Here, we don't want to use them.
let global_options = GlobalOptions::new().use_custom_resolvers(false);
lofty::apply_global_options(global_options);sourcepub fn allocation_limit(&mut self, allocation_limit: usize) -> Self
pub fn allocation_limit(&mut self, allocation_limit: usize) -> Self
The maximum number of bytes to allocate for any single tag item
This is a safety measure to prevent allocating too much memory for a single tag item. If a tag item
exceeds this limit, the allocator will return crate::error::ErrorKind::TooMuchData.
Examples
use lofty::GlobalOptions;
// I have files with gigantic images, I'll double the allocation limit!
let global_options = GlobalOptions::new().allocation_limit(32 * 1024 * 1024);
lofty::apply_global_options(global_options);Trait Implementations§
source§impl Clone for GlobalOptions
impl Clone for GlobalOptions
source§fn clone(&self) -> GlobalOptions
fn clone(&self) -> GlobalOptions
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 GlobalOptions
impl Debug for GlobalOptions
source§impl Default for GlobalOptions
impl Default for GlobalOptions
source§impl Ord for GlobalOptions
impl Ord for GlobalOptions
source§fn cmp(&self, other: &GlobalOptions) -> Ordering
fn cmp(&self, other: &GlobalOptions) -> 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 GlobalOptions
impl PartialEq for GlobalOptions
source§fn eq(&self, other: &GlobalOptions) -> bool
fn eq(&self, other: &GlobalOptions) -> bool
This method tests for
self and other values to be equal, and is used
by ==.source§impl PartialOrd for GlobalOptions
impl PartialOrd for GlobalOptions
source§fn partial_cmp(&self, other: &GlobalOptions) -> Option<Ordering>
fn partial_cmp(&self, other: &GlobalOptions) -> 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 GlobalOptions
impl Eq for GlobalOptions
impl StructuralEq for GlobalOptions
impl StructuralPartialEq for GlobalOptions
Auto Trait Implementations§
impl RefUnwindSafe for GlobalOptions
impl Send for GlobalOptions
impl Sync for GlobalOptions
impl Unpin for GlobalOptions
impl UnwindSafe for GlobalOptions
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