Replaced trim_right() with trim_end(), as the former is deprecated

This commit is contained in:
Emmanuel Gil Peyrot 2019-06-18 17:32:42 +02:00
parent 05e02c886c
commit a43401b6c4
1 changed files with 2 additions and 2 deletions

View File

@ -281,7 +281,7 @@ pub fn observe_mpv_property(instance: &Mpv, id: &usize, property: &str) -> Resul
pub fn listen(instance: &mut Mpv) -> Result<Event, Error> { pub fn listen(instance: &mut Mpv) -> Result<Event, Error> {
let mut response = String::new(); let mut response = String::new();
instance.reader.read_line(&mut response).unwrap(); instance.reader.read_line(&mut response).unwrap();
response = response.trim_right().to_string(); response = response.trim_end().to_string();
match serde_json::from_str::<Value>(&response) { match serde_json::from_str::<Value>(&response) {
Ok(e) => { Ok(e) => {
if let Value::String(ref name) = e["event"] { if let Value::String(ref name) = e["event"] {
@ -406,7 +406,7 @@ pub fn listen(instance: &mut Mpv) -> Result<Event, Error> {
pub fn listen_raw(instance: &mut Mpv) -> String { pub fn listen_raw(instance: &mut Mpv) -> String {
let mut response = String::new(); let mut response = String::new();
instance.reader.read_line(&mut response).unwrap(); instance.reader.read_line(&mut response).unwrap();
response.trim_right().to_string() response.trim_end().to_string()
// let mut stream = &instance.0; // let mut stream = &instance.0;
// let mut buffer = [0; 32]; // let mut buffer = [0; 32];
// stream.read(&mut buffer[..]).unwrap(); // stream.read(&mut buffer[..]).unwrap();