From 712333ab9eb7050a3811d45e95ab3289cc3b5d7d Mon Sep 17 00:00:00 2001 From: Oystein Tveit Date: Fri, 3 May 2024 14:01:51 +0200 Subject: [PATCH] use usize for request ids --- src/core_api.rs | 4 ++-- src/highlevel_api_extension.rs | 8 ++++---- src/ipc.rs | 8 ++++---- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/core_api.rs b/src/core_api.rs index e45dbd4..69e8686 100644 --- a/src/core_api.rs +++ b/src/core_api.rs @@ -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. diff --git a/src/highlevel_api_extension.rs b/src/highlevel_api_extension.rs index d6df375..61056b7 100644 --- a/src/highlevel_api_extension.rs +++ b/src/highlevel_api_extension.rs @@ -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; @@ -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 } diff --git a/src/ipc.rs b/src/ipc.rs index e269c7f..8531639 100644 --- a/src/ipc.rs +++ b/src/ipc.rs @@ -24,8 +24,8 @@ pub(crate) enum MpvIpcCommand { Command(Vec), 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, 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, MpvError> { self.send_command(&[json!("unobserve_property"), json!(id)]) .await