Fix return type of deser function
This commit is contained in:
parent
9b73d95340
commit
da8430092b
|
@ -32,7 +32,7 @@ impl<'de, Iter: Iterator<Item = (&'de str, &'de str)>> de::Deserializer<'de> for
|
|||
}
|
||||
}
|
||||
|
||||
pub fn deserialize_response<'a, I: Iterator<Item = &'a str>, T: de::Deserialize<'a>>(input: I) -> Result<Track, Error> {
|
||||
pub fn deserialize_response<'a, I: Iterator<Item = &'a str>, T: de::DeserializeOwned>(input: I) -> Result<T, Error> {
|
||||
let mut map: HashMap<String, String> = HashMap::new();
|
||||
for line in input {
|
||||
if line.starts_with("OK") {
|
||||
|
@ -80,7 +80,7 @@ duration: 512.380
|
|||
Pos: 1367
|
||||
Id: 1368
|
||||
OK";
|
||||
let t = deserialize_response::<'_, _, Track>(input_str.lines()).unwrap();
|
||||
let t: Track = deserialize_response(input_str.lines()).unwrap();
|
||||
assert_eq!(
|
||||
t,
|
||||
Track {
|
||||
|
@ -132,7 +132,7 @@ Performer: Jane Glover
|
|||
Pos: 3439
|
||||
Id: 3440
|
||||
OK"#;
|
||||
let t = deserialize_response::<'_, _, Track>(input_str.lines()).unwrap();
|
||||
let t: Track = deserialize_response(input_str.lines()).unwrap();
|
||||
assert_eq!(
|
||||
t,
|
||||
Track {
|
||||
|
|
Loading…
Reference in New Issue
Block a user