From 674bb719de0dcb476b6fa192db9b6a3a50c322fa Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Sun, 15 Dec 2024 20:59:57 +0300 Subject: [PATCH] lib: generic `Errors` section to satisfy linter --- src/lib.rs | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/src/lib.rs b/src/lib.rs index 733c262a..de5f21a2 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -114,6 +114,9 @@ pub async fn send_ipc_command( /// /// This enum provides variants for frequently used MPV commands, which can be converted to their /// string equivalents using the `as_str` method. +/// +/// # Errors +/// Returns an error if the connection to the socket fails or the command execution encounters issues. #[derive(Debug)] pub enum MpvCommand { /// Sets a property to a specified value in MPV. @@ -168,6 +171,9 @@ impl MpvCommand { /// /// # Returns /// A `Result` containing the response data. +/// +/// # Errors +/// Returns an error if the connection to the socket fails or the command execution encounters issues. pub async fn set_property( property: &str, value: &Value, @@ -188,6 +194,9 @@ pub async fn set_property( /// /// # Returns /// A `Result` containing the response data. +/// +/// # Errors +/// Returns an error if the connection to the socket fails or the command execution encounters issues. pub async fn playlist_next(socket_path: Option<&str>) -> io::Result> { send_ipc_command(MpvCommand::PlaylistNext.as_str(), &[], socket_path).await } @@ -199,6 +208,9 @@ pub async fn playlist_next(socket_path: Option<&str>) -> io::Result) -> io::Result> { send_ipc_command(MpvCommand::PlaylistPrev.as_str(), &[], socket_path).await } @@ -211,6 +223,9 @@ pub async fn playlist_prev(socket_path: Option<&str>) -> io::Result) -> io::Result> { send_ipc_command(MpvCommand::Seek.as_str(), &[json!(seconds)], socket_path).await } @@ -222,6 +237,9 @@ pub async fn seek(seconds: f64, socket_path: Option<&str>) -> io::Result) -> io::Result> { send_ipc_command(MpvCommand::Quit.as_str(), &[], socket_path).await } @@ -235,6 +253,9 @@ pub async fn quit(socket_path: Option<&str>) -> io::Result> { /// /// # Returns /// A `Result` containing the response data. +/// +/// # Errors +/// Returns an error if the connection to the socket fails or the command execution encounters issues. pub async fn playlist_move( from_index: usize, to_index: usize, @@ -256,6 +277,9 @@ pub async fn playlist_move( /// /// # Returns /// A `Result` containing the response data. +/// +/// # Errors +/// Returns an error if the connection to the socket fails or the command execution encounters issues. pub async fn playlist_remove( index: Option, socket_path: Option<&str>, @@ -274,6 +298,9 @@ pub async fn playlist_remove( /// /// # Returns /// A `Result` containing the response data. +/// +/// # Errors +/// Returns an error if the connection to the socket fails or the command execution encounters issues. pub async fn playlist_clear(socket_path: Option<&str>) -> io::Result> { send_ipc_command(MpvCommand::PlaylistClear.as_str(), &[], socket_path).await } @@ -286,6 +313,9 @@ pub async fn playlist_clear(socket_path: Option<&str>) -> io::Result) -> io::Result> { send_ipc_command( MpvCommand::GetProperty.as_str(), @@ -304,6 +334,9 @@ pub async fn get_property(property: &str, socket_path: Option<&str>) -> io::Resu /// /// # Returns /// A `Result` containing the response data. +/// +/// # Errors +/// Returns an error if the connection to the socket fails or the command execution encounters issues. pub async fn loadfile( filename: &str, append: bool,