Change code order

This commit is contained in:
Wojciech Kozlowski 2023-03-31 13:13:38 +09:00
parent ecc4b64e43
commit b1058f5a0b

View File

@ -8,6 +8,10 @@ trait QueryOptionArgBeets {
fn to_arg(&self, option_name: &str) -> Option<String>; fn to_arg(&self, option_name: &str) -> Option<String>;
} }
trait QueryArgsBeets {
fn to_args(&self) -> Vec<String>;
}
trait SimpleOption {} trait SimpleOption {}
impl SimpleOption for String {} impl SimpleOption for String {}
impl SimpleOption for u32 {} impl SimpleOption for u32 {}
@ -34,10 +38,6 @@ impl QueryOptionArgBeets for QueryOption<Vec<String>> {
} }
} }
trait QueryArgsBeets {
fn to_args(&self) -> Vec<String>;
}
impl QueryArgsBeets for Query { 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![];
@ -78,12 +78,6 @@ pub struct Beets {
executor: Box<dyn BeetsExecutor>, executor: Box<dyn BeetsExecutor>,
} }
impl Beets {
pub fn new(executor: Box<dyn BeetsExecutor>) -> Beets {
Beets { executor }
}
}
trait LibraryPrivate { trait LibraryPrivate {
const CMD_LIST: &'static str; const CMD_LIST: &'static str;
const LIST_FORMAT_SEPARATOR: &'static str; const LIST_FORMAT_SEPARATOR: &'static str;
@ -93,6 +87,12 @@ trait LibraryPrivate {
fn list_to_albums(list_output: Vec<String>) -> Result<Vec<Album>, Error>; fn list_to_albums(list_output: Vec<String>) -> Result<Vec<Album>, Error>;
} }
impl Beets {
pub fn new(executor: Box<dyn BeetsExecutor>) -> Beets {
Beets { executor }
}
}
impl Library for Beets { impl Library for Beets {
fn list(&mut self, query: &Query) -> Result<Vec<Album>, Error> { fn list(&mut self, query: &Query) -> Result<Vec<Album>, Error> {
let cmd = Self::list_cmd_and_args(query); let cmd = Self::list_cmd_and_args(query);