From eb26502285c450ea0a0b3c9dcf4c3228415d6dcf Mon Sep 17 00:00:00 2001 From: h7x4 Date: Fri, 2 Jan 2026 19:55:50 +0900 Subject: [PATCH] src/event_parser: more doccomments for public items --- src/event_parser.rs | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/src/event_parser.rs b/src/event_parser.rs index d906d60..c8a9ea5 100644 --- a/src/event_parser.rs +++ b/src/event_parser.rs @@ -7,15 +7,37 @@ use serde_json::{Map, Value}; use crate::{MpvDataType, MpvError, ipc::MpvIpcEvent, message_parser::json_to_value}; +/// Reason behind the `MPV_EVENT_END_FILE` event. +/// +/// Ref: #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] #[serde(rename_all = "kebab-case")] pub enum EventEndFileReason { + /// The file has ended. This can (but doesn't have to) include + /// incomplete files or broken network connections under circumstances. Eof, + + /// Playback was ended by a command. Stop, + + /// Playback was ended by sending the quit command. Quit, + + /// An error happened. In this case, an `error` field is present with the error string. Error, + + /// Happens with playlists and similar. For details, see + /// [`MPV_END_FILE_REASON_REDIRECT`](https://github.com/mpv-player/mpv/blob/72efbfd009a2b3259055133d74b88c81b1115ae1/include/mpv/client.h#L1493) + /// in the C API. Redirect, + + /// Unknown. Normally doesn't happen, unless the Lua API is out of sync + /// with the C API. (Likewise, it could happen that your script gets reason + /// strings that did not exist yet at the time your script was written.) Unknown, + + /// A catch-all enum variant in case `mpvipc-async` has not implemented the + /// returned error yet. Unimplemented(String), } @@ -34,6 +56,11 @@ impl FromStr for EventEndFileReason { } } +/// The log level of a log message event. +/// +/// Ref: +/// - +/// - #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] #[serde(rename_all = "kebab-case")] pub enum EventLogMessageLevel { @@ -44,6 +71,9 @@ pub enum EventLogMessageLevel { Verbose, Debug, Trace, + + /// A catch-all enum variant in case `mpvipc-async` has not implemented the + /// returned log-level yet. Unimplemented(String), }