mirror of
https://github.com/librespot-org/librespot.git
synced 2024-12-18 17:11:53 +00:00
Use function types instead of closures for backend builders.
This commit is contained in:
parent
5974cf7f24
commit
58b1625445
1 changed files with 6 additions and 7 deletions
|
@ -74,20 +74,19 @@ use self::pipe::StdoutSink;
|
|||
|
||||
declare_backends! {
|
||||
pub const BACKENDS : &'static [
|
||||
(&'static str,
|
||||
&'static (Fn(Option<&str>) -> Box<Sink> + Sync + Send + 'static))
|
||||
(&'static str, fn(Option<&str>) -> Box<Sink>)
|
||||
] = &[
|
||||
#[cfg(feature = "alsa-backend")]
|
||||
("alsa", &mk_sink::<AlsaSink>),
|
||||
("alsa", mk_sink::<AlsaSink>),
|
||||
#[cfg(feature = "portaudio-backend")]
|
||||
("portaudio", &mk_sink::<PortAudioSink>),
|
||||
("portaudio", mk_sink::<PortAudioSink>),
|
||||
#[cfg(feature = "pulseaudio-backend")]
|
||||
("pulseaudio", &mk_sink::<PulseAudioSink>),
|
||||
("pipe", &mk_sink::<StdoutSink>),
|
||||
("pulseaudio", mk_sink::<PulseAudioSink>),
|
||||
("pipe", mk_sink::<StdoutSink>),
|
||||
];
|
||||
}
|
||||
|
||||
pub fn find<T: AsRef<str>>(name: Option<T>) -> Option<&'static (Fn(Option<&str>) -> Box<Sink> + Send + Sync)> {
|
||||
pub fn find<T: AsRef<str>>(name: Option<T>) -> Option<fn(Option<&str>) -> Box<Sink>> {
|
||||
if let Some(name) = name.as_ref().map(AsRef::as_ref) {
|
||||
BACKENDS.iter().find(|backend| name == backend.0).map(|backend| backend.1)
|
||||
} else {
|
||||
|
|
Loading…
Reference in a new issue