mirror of
https://github.com/Serial-ATA/lofty-rs
synced 2024-11-15 08:57:08 +00:00
Resolve: Remove remove_custom_resolver
This commit is contained in:
parent
390512bda3
commit
a08b47bf31
1 changed files with 1 additions and 18 deletions
|
@ -95,7 +95,7 @@ impl<T: FileResolver> ObjectSafeFileResolver for GhostlyResolver<T> {
|
||||||
///
|
///
|
||||||
/// # Panics
|
/// # Panics
|
||||||
///
|
///
|
||||||
/// * Attempting to register an existing name or type (See [`remove_custom_resolver`])
|
/// * Attempting to register an existing name or type
|
||||||
/// * See [`Mutex::lock`]
|
/// * See [`Mutex::lock`]
|
||||||
pub fn register_custom_resolver<T: FileResolver + 'static>(name: &'static str) {
|
pub fn register_custom_resolver<T: FileResolver + 'static>(name: &'static str) {
|
||||||
let mut res = CUSTOM_RESOLVERS.lock().unwrap();
|
let mut res = CUSTOM_RESOLVERS.lock().unwrap();
|
||||||
|
@ -111,23 +111,6 @@ pub fn register_custom_resolver<T: FileResolver + 'static>(name: &'static str) {
|
||||||
res.insert(name, Box::leak::<'static>(b));
|
res.insert(name, Box::leak::<'static>(b));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Remove a registered file resolver
|
|
||||||
///
|
|
||||||
/// # Panics
|
|
||||||
///
|
|
||||||
/// See [`Mutex::lock`]
|
|
||||||
pub fn remove_custom_resolver(name: &'static str) {
|
|
||||||
let mut resolvers = CUSTOM_RESOLVERS.lock().unwrap();
|
|
||||||
|
|
||||||
if let Some(res) = resolvers.remove(name) {
|
|
||||||
unsafe {
|
|
||||||
#[allow(trivial_casts)]
|
|
||||||
let b = Box::from_raw(res as *const _ as *mut dyn ObjectSafeFileResolver);
|
|
||||||
drop(b);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use crate::id3::v2::ID3v2Tag;
|
use crate::id3::v2::ID3v2Tag;
|
||||||
|
|
Loading…
Reference in a new issue