use usize for request ids

master
Oystein Kristoffer Tveit 2024-05-03 22:29:27 +02:00
parent cb0921144d
commit 878cebbc9f
Signed by: oysteikt
GPG Key ID: 9F2F7D8250F35146
3 changed files with 10 additions and 10 deletions

View File

@ -41,7 +41,7 @@ pub enum MpvCommand {
to: usize,
},
Observe {
id: isize,
id: usize,
property: String,
},
PlaylistNext,
@ -59,7 +59,7 @@ pub enum MpvCommand {
option: SeekOptions,
},
Stop,
Unobserve(isize),
Unobserve(usize),
}
/// Helper trait to keep track of the string literals that mpv expects.

View File

@ -68,8 +68,8 @@ pub trait MpvExt {
async fn restart(&self) -> Result<(), MpvError>;
async fn prev(&self) -> Result<(), MpvError>;
async fn pause(&self) -> Result<(), MpvError>;
async fn unobserve_property(&self, id: isize) -> Result<(), MpvError>;
async fn observe_property(&self, id: isize, property: &str) -> Result<(), MpvError>;
async fn unobserve_property(&self, id: usize) -> Result<(), MpvError>;
async fn observe_property(&self, id: usize, property: &str) -> Result<(), MpvError>;
async fn next(&self) -> Result<(), MpvError>;
async fn kill(&self) -> Result<(), MpvError>;
async fn get_playlist(&self) -> Result<Playlist, MpvError>;
@ -95,7 +95,7 @@ impl MpvExt for Mpv {
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 {
id,
property: property.to_string(),
@ -103,7 +103,7 @@ impl MpvExt for Mpv {
.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
}

View File

@ -24,8 +24,8 @@ pub(crate) enum MpvIpcCommand {
Command(Vec<String>),
GetProperty(String),
SetProperty(String, Value),
ObserveProperty(isize, String),
UnobserveProperty(isize),
ObserveProperty(usize, String),
UnobserveProperty(usize),
Exit,
}
@ -114,7 +114,7 @@ impl MpvIpc {
pub(crate) async fn observe_property(
&mut self,
id: isize,
id: usize,
property: &str,
) -> Result<Option<Value>, MpvError> {
self.send_command(&[json!("observe_property"), json!(id), json!(property)])
@ -123,7 +123,7 @@ impl MpvIpc {
pub(crate) async fn unobserve_property(
&mut self,
id: isize,
id: usize,
) -> Result<Option<Value>, MpvError> {
self.send_command(&[json!("unobserve_property"), json!(id)])
.await