internal: casts server response to server rsp type
This commit is contained in:
parent
2561b3fde1
commit
3535da9a39
2 changed files with 6 additions and 3 deletions
|
@ -40,6 +40,7 @@ struct CliArgs {
|
||||||
value_parser(["title", "artist", "album"])
|
value_parser(["title", "artist", "album"])
|
||||||
)]
|
)]
|
||||||
search_field: Option<String>,
|
search_field: Option<String>,
|
||||||
|
// Add flag for "search filepaths too"
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
|
@ -78,6 +79,8 @@ fn main() {
|
||||||
|
|
||||||
socket.write_message(Message::Text(message_string)).unwrap();
|
socket.write_message(Message::Text(message_string)).unwrap();
|
||||||
let msg = socket.read_message().expect("Error reading message");
|
let msg = socket.read_message().expect("Error reading message");
|
||||||
println!("Received: {}", msg);
|
let resp: message_types::ServerResponse =
|
||||||
|
serde_json::from_str(msg.into_text().unwrap().as_str()).unwrap();
|
||||||
|
println!("recieved: {:?}", resp);
|
||||||
socket.close(None).unwrap();
|
socket.close(None).unwrap();
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,7 @@ impl Default for ItemTag {
|
||||||
artist: String::new(),
|
artist: String::new(),
|
||||||
album: String::new(),
|
album: String::new(),
|
||||||
album_artist: String::new(),
|
album_artist: String::new(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -73,7 +73,7 @@ impl PartialTag {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize)]
|
#[derive(Serialize, Deserialize, Debug)]
|
||||||
pub struct ServerResponse {
|
pub struct ServerResponse {
|
||||||
pub search_results: Vec<ItemTag>,
|
pub search_results: Vec<ItemTag>,
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue