internal: casts server response to server rsp type

This commit is contained in:
Nickiel12 2022-12-21 19:19:19 -08:00
parent 2561b3fde1
commit 3535da9a39
2 changed files with 6 additions and 3 deletions

View file

@ -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();
} }

View file

@ -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>,
} }