use usize for request ids
This commit is contained in:
parent
cb0921144d
commit
878cebbc9f
|
@ -41,7 +41,7 @@ pub enum MpvCommand {
|
||||||
to: usize,
|
to: usize,
|
||||||
},
|
},
|
||||||
Observe {
|
Observe {
|
||||||
id: isize,
|
id: usize,
|
||||||
property: String,
|
property: String,
|
||||||
},
|
},
|
||||||
PlaylistNext,
|
PlaylistNext,
|
||||||
|
@ -59,7 +59,7 @@ pub enum MpvCommand {
|
||||||
option: SeekOptions,
|
option: SeekOptions,
|
||||||
},
|
},
|
||||||
Stop,
|
Stop,
|
||||||
Unobserve(isize),
|
Unobserve(usize),
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Helper trait to keep track of the string literals that mpv expects.
|
/// Helper trait to keep track of the string literals that mpv expects.
|
||||||
|
|
|
@ -68,8 +68,8 @@ pub trait MpvExt {
|
||||||
async fn restart(&self) -> Result<(), MpvError>;
|
async fn restart(&self) -> Result<(), MpvError>;
|
||||||
async fn prev(&self) -> Result<(), MpvError>;
|
async fn prev(&self) -> Result<(), MpvError>;
|
||||||
async fn pause(&self) -> Result<(), MpvError>;
|
async fn pause(&self) -> Result<(), MpvError>;
|
||||||
async fn unobserve_property(&self, id: isize) -> Result<(), MpvError>;
|
async fn unobserve_property(&self, id: usize) -> Result<(), MpvError>;
|
||||||
async fn observe_property(&self, id: isize, property: &str) -> Result<(), MpvError>;
|
async fn observe_property(&self, id: usize, property: &str) -> Result<(), MpvError>;
|
||||||
async fn next(&self) -> Result<(), MpvError>;
|
async fn next(&self) -> Result<(), MpvError>;
|
||||||
async fn kill(&self) -> Result<(), MpvError>;
|
async fn kill(&self) -> Result<(), MpvError>;
|
||||||
async fn get_playlist(&self) -> Result<Playlist, MpvError>;
|
async fn get_playlist(&self) -> Result<Playlist, MpvError>;
|
||||||
|
@ -95,7 +95,7 @@ impl MpvExt for Mpv {
|
||||||
self.run_command(MpvCommand::PlaylistNext).await
|
self.run_command(MpvCommand::PlaylistNext).await
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn observe_property(&self, id: isize, property: &str) -> Result<(), MpvError> {
|
async fn observe_property(&self, id: usize, property: &str) -> Result<(), MpvError> {
|
||||||
self.run_command(MpvCommand::Observe {
|
self.run_command(MpvCommand::Observe {
|
||||||
id,
|
id,
|
||||||
property: property.to_string(),
|
property: property.to_string(),
|
||||||
|
@ -103,7 +103,7 @@ impl MpvExt for Mpv {
|
||||||
.await
|
.await
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn unobserve_property(&self, id: isize) -> Result<(), MpvError> {
|
async fn unobserve_property(&self, id: usize) -> Result<(), MpvError> {
|
||||||
self.run_command(MpvCommand::Unobserve(id)).await
|
self.run_command(MpvCommand::Unobserve(id)).await
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,8 +24,8 @@ pub(crate) enum MpvIpcCommand {
|
||||||
Command(Vec<String>),
|
Command(Vec<String>),
|
||||||
GetProperty(String),
|
GetProperty(String),
|
||||||
SetProperty(String, Value),
|
SetProperty(String, Value),
|
||||||
ObserveProperty(isize, String),
|
ObserveProperty(usize, String),
|
||||||
UnobserveProperty(isize),
|
UnobserveProperty(usize),
|
||||||
Exit,
|
Exit,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -114,7 +114,7 @@ impl MpvIpc {
|
||||||
|
|
||||||
pub(crate) async fn observe_property(
|
pub(crate) async fn observe_property(
|
||||||
&mut self,
|
&mut self,
|
||||||
id: isize,
|
id: usize,
|
||||||
property: &str,
|
property: &str,
|
||||||
) -> Result<Option<Value>, MpvError> {
|
) -> Result<Option<Value>, MpvError> {
|
||||||
self.send_command(&[json!("observe_property"), json!(id), json!(property)])
|
self.send_command(&[json!("observe_property"), json!(id), json!(property)])
|
||||||
|
@ -123,7 +123,7 @@ impl MpvIpc {
|
||||||
|
|
||||||
pub(crate) async fn unobserve_property(
|
pub(crate) async fn unobserve_property(
|
||||||
&mut self,
|
&mut self,
|
||||||
id: isize,
|
id: usize,
|
||||||
) -> Result<Option<Value>, MpvError> {
|
) -> Result<Option<Value>, MpvError> {
|
||||||
self.send_command(&[json!("unobserve_property"), json!(id)])
|
self.send_command(&[json!("unobserve_property"), json!(id)])
|
||||||
.await
|
.await
|
||||||
|
|
Loading…
Reference in New Issue