move match macro into utils module
This commit is contained in:
parent
1ff845d48e
commit
943174bafa
2 changed files with 12 additions and 9 deletions
|
@ -14,15 +14,7 @@ use opus_headers;
|
||||||
use crate::utils;
|
use crate::utils;
|
||||||
use crate::utils::AudioFormat;
|
use crate::utils::AudioFormat;
|
||||||
|
|
||||||
macro_rules! match_ignore_case {
|
use crate::match_ignore_case;
|
||||||
(match $v:ident {
|
|
||||||
$( $lit:literal => $res:expr, )*
|
|
||||||
_ => $catch_all:expr $(,)?
|
|
||||||
}) => {{
|
|
||||||
$( if $lit.eq_ignore_ascii_case(&$v) { $res } else )*
|
|
||||||
{ $catch_all }
|
|
||||||
}};
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Debug, Clone, PartialEq)]
|
#[derive(Debug, Clone, PartialEq)]
|
||||||
pub struct SongTags {
|
pub struct SongTags {
|
||||||
|
|
11
src/utils.rs
11
src/utils.rs
|
@ -3,6 +3,17 @@ use app_dirs::{app_root, AppDataType, AppInfo};
|
||||||
use std::fs;
|
use std::fs;
|
||||||
use std::path::{Path, PathBuf};
|
use std::path::{Path, PathBuf};
|
||||||
|
|
||||||
|
#[macro_export]
|
||||||
|
macro_rules! match_ignore_case {
|
||||||
|
(match $v:ident {
|
||||||
|
$( $lit:literal => $res:expr, )*
|
||||||
|
_ => $catch_all:expr $(,)?
|
||||||
|
}) => {{
|
||||||
|
$( if $lit.eq_ignore_ascii_case(&$v) { $res } else )*
|
||||||
|
{ $catch_all }
|
||||||
|
}};
|
||||||
|
}
|
||||||
|
|
||||||
#[cfg(target_family = "windows")]
|
#[cfg(target_family = "windows")]
|
||||||
const APP_INFO: AppInfo = AppInfo {
|
const APP_INFO: AppInfo = AppInfo {
|
||||||
name: "Polaris",
|
name: "Polaris",
|
||||||
|
|
Loading…
Add table
Reference in a new issue