Resolve "Local collection trait and beets implementation" #9
@ -4,11 +4,15 @@ use crate::{Album, Track};
|
|||||||
|
|
||||||
use super::{Error, Library, Query, QueryOption};
|
use super::{Error, Library, Query, QueryOption};
|
||||||
|
|
||||||
pub trait SimpleOption {}
|
trait QueryOptionArgBeets {
|
||||||
|
fn to_arg(&self, option_name: &str) -> Option<String>;
|
||||||
|
}
|
||||||
|
|
||||||
|
trait SimpleOption {}
|
||||||
impl SimpleOption for String {}
|
impl SimpleOption for String {}
|
||||||
impl SimpleOption for u32 {}
|
impl SimpleOption for u32 {}
|
||||||
|
|
||||||
impl<T: SimpleOption + Display> QueryOption<T> {
|
impl<T: SimpleOption + Display> QueryOptionArgBeets for QueryOption<T> {
|
||||||
fn to_arg(&self, option_name: &str) -> Option<String> {
|
fn to_arg(&self, option_name: &str) -> Option<String> {
|
||||||
let (negate, value) = match self {
|
let (negate, value) = match self {
|
||||||
Self::Include(value) => ("", value),
|
Self::Include(value) => ("", value),
|
||||||
@ -19,7 +23,7 @@ impl<T: SimpleOption + Display> QueryOption<T> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl QueryOption<Vec<String>> {
|
impl QueryOptionArgBeets for QueryOption<Vec<String>> {
|
||||||
fn to_arg(&self, option_name: &str) -> Option<String> {
|
fn to_arg(&self, option_name: &str) -> Option<String> {
|
||||||
let (negate, vec) = match self {
|
let (negate, vec) = match self {
|
||||||
Self::Include(value) => ("", value),
|
Self::Include(value) => ("", value),
|
||||||
@ -30,7 +34,11 @@ impl QueryOption<Vec<String>> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Query {
|
trait QueryArgsBeets {
|
||||||
|
fn to_args(&self) -> Vec<String>;
|
||||||
|
}
|
||||||
|
|
||||||
|
impl QueryArgsBeets for Query {
|
||||||
fn to_args(&self) -> Vec<String> {
|
fn to_args(&self) -> Vec<String> {
|
||||||
let mut arguments: Vec<String> = vec![];
|
let mut arguments: Vec<String> = vec![];
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user