Deps: Replace OnceCell with std::sync::OnceLock (#207)

This commit is contained in:
Gnome!
2023-12-02 17:22:00 +00:00
committed by Kyle Simpson
parent 2146846df4
commit 743a1d262e
11 changed files with 59 additions and 58 deletions

View File

@@ -3,12 +3,12 @@ use crate::driver::{Channels, DecodeMode, SampleRate};
#[cfg(feature = "driver")]
use crate::{
driver::{
get_default_scheduler,
retry::Retry,
tasks::disposal::DisposalThread,
CryptoMode,
MixMode,
Scheduler,
DEFAULT_SCHEDULER,
},
input::codecs::*,
};
@@ -173,19 +173,15 @@ pub struct Config {
/// Registry of the inner codecs supported by the driver, adding audiopus-based
/// Opus codec support to all of Symphonia's default codecs.
///
/// Defaults to [`CODEC_REGISTRY`].
///
/// [`CODEC_REGISTRY`]: static@CODEC_REGISTRY
/// Defaults to [`get_codec_registry`].
pub codec_registry: &'static CodecRegistry,
#[cfg(feature = "driver")]
#[derivative(Debug = "ignore")]
/// Registry of the muxers and container formats supported by the driver.
///
/// Defaults to [`PROBE`], which includes all of Symphonia's default format handlers
/// Defaults to [`get_probe`], which includes all of Symphonia's default format handlers
/// and DCA format support.
///
/// [`PROBE`]: static@PROBE
pub format_registry: &'static Probe,
#[cfg(feature = "driver")]
@@ -203,7 +199,7 @@ pub struct Config {
/// The scheduler is responsible for mapping idle and active [`Driver`] instances
/// to threads.
///
/// If set to None, then songbird will initialise the [`DEFAULT_SCHEDULER`].
/// If set to None, then songbird will use [`get_default_scheduler`].
///
/// [`Driver`]: crate::Driver
pub scheduler: Option<Scheduler>,
@@ -249,9 +245,9 @@ impl Default for Config {
#[cfg(feature = "driver")]
driver_timeout: Some(Duration::from_secs(10)),
#[cfg(feature = "driver")]
codec_registry: &CODEC_REGISTRY,
codec_registry: get_codec_registry(),
#[cfg(feature = "driver")]
format_registry: &PROBE,
format_registry: get_probe(),
#[cfg(feature = "driver")]
disposer: None,
#[cfg(feature = "driver")]
@@ -391,7 +387,7 @@ impl Config {
pub fn get_scheduler(&self) -> Scheduler {
self.scheduler
.as_ref()
.unwrap_or(&*DEFAULT_SCHEDULER)
.unwrap_or(get_default_scheduler())
.clone()
}