diff --git a/src/client/connection.rs b/src/client/connection.rs index 0ea5a26..505cf6c 100644 --- a/src/client/connection.rs +++ b/src/client/connection.rs @@ -87,6 +87,7 @@ impl ReidentifyReceiverList { /// Errors that can occur while performing the initial handshake with obs-websocket. #[derive(Debug, thiserror::Error)] +#[non_exhaustive] pub enum HandshakeError { /// The connection to obs-websocket was interrupted while trying to read a message. #[error("connection to obs-websocket was closed: {}", match .0 { diff --git a/src/common.rs b/src/common.rs index 8b778f4..fa0658a 100644 --- a/src/common.rs +++ b/src/common.rs @@ -9,6 +9,7 @@ use crate::Error; #[derive( Clone, Copy, Debug, Default, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize, )] +#[non_exhaustive] pub enum MonitorType { /// No monitoring. #[default] @@ -91,6 +92,7 @@ impl From for u8 { #[derive( Clone, Copy, Debug, Default, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize, )] +#[non_exhaustive] pub enum BoundsType { /// No bounds. #[default] @@ -120,6 +122,7 @@ pub enum BoundsType { #[derive( Clone, Copy, Debug, Default, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize, )] +#[non_exhaustive] pub enum MediaAction { /// No media action. #[default] @@ -149,6 +152,7 @@ pub enum MediaAction { #[derive( Clone, Copy, Debug, Default, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize, )] +#[non_exhaustive] pub enum BlendMode { /// No blending, overlaying without mixing colors, except for transparency. #[default] diff --git a/src/events.rs b/src/events.rs index 4958f98..8a85e39 100644 --- a/src/events.rs +++ b/src/events.rs @@ -13,6 +13,7 @@ use crate::{ /// All possible event types that can occur while the user interacts with OBS. #[derive(Clone, Debug, Deserialize, PartialEq, Serialize)] #[serde(tag = "eventType", content = "eventData")] +#[non_exhaustive] pub enum Event { // -------------------------------- // Config @@ -557,6 +558,7 @@ pub struct InputVolumeMeter { /// The output state describes the current status of any output (like recording, virtual-cam, ...). #[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)] +#[non_exhaustive] pub enum OutputState { /// A request to start the output has been issued. #[serde(rename = "OBS_WEBSOCKET_OUTPUT_STARTING")] diff --git a/src/lib.rs b/src/lib.rs index cf8b0a1..730e9c1 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -55,6 +55,7 @@ pub type Result = std::result::Result; /// Errors that can occur while using this crate. #[derive(Debug, thiserror::Error)] +#[non_exhaustive] pub enum Error { /// An error occurred while trying to connect to the web-socket. #[error("failed to connect to the obs-websocket plugin")] diff --git a/src/requests/config.rs b/src/requests/config.rs index 95baf3b..fd51512 100644 --- a/src/requests/config.rs +++ b/src/requests/config.rs @@ -46,6 +46,7 @@ impl<'a> From> for super::RequestType<'a> { /// [`crate::client::Config::set_persistent_data`] as part of /// [`SetPersistentData`]. #[derive(Clone, Copy, Serialize)] +#[non_exhaustive] pub enum Realm { /// Data located in the global settings. #[serde(rename = "OBS_WEBSOCKET_DATA_REALM_GLOBAL")] diff --git a/src/requests/custom/source_settings.rs b/src/requests/custom/source_settings.rs index 1dec589..b8da9df 100644 --- a/src/requests/custom/source_settings.rs +++ b/src/requests/custom/source_settings.rs @@ -131,6 +131,7 @@ pub struct DisplayCapture<'a> { } /// The capture cropping for a [`DisplayCapture`] source. +#[non_exhaustive] pub enum CropMode<'a> { /// Disable any cropping. None, @@ -330,6 +331,7 @@ impl<'a> Default for SlideshowFile<'a> { /// Playback behavior setting for use in [`Slideshow`]. #[derive(Clone, Copy, Serialize)] #[serde(rename_all = "snake_case")] +#[non_exhaustive] pub enum PlaybackBehavior { /// Always play even when not visible. AlwaysPlay, @@ -342,6 +344,7 @@ pub enum PlaybackBehavior { /// Playback control mode for use in [`Slideshow`]. #[derive(Clone, Copy, Serialize)] #[serde(rename_all = "snake_case")] +#[non_exhaustive] pub enum SlideMode { /// Automatic. ModeAuto, @@ -358,6 +361,7 @@ impl Default for SlideMode { /// Transition animation between images in a [`Slideshow`]. #[derive(Serialize)] #[serde(rename_all = "snake_case")] +#[non_exhaustive] pub enum Transition { /// Immediately replace without animation. Cut, @@ -378,6 +382,7 @@ impl Default for Transition { /// Aspect ratios and bounding sizes for use in [`Slideshow`]. #[derive(Clone, Copy, Serialize)] #[serde(into = "String")] +#[non_exhaustive] pub enum CustomSize { /// Automatically detect a ratio based on the input. Automatic, @@ -451,6 +456,7 @@ pub struct FfmpegSource<'a> { /// YUV color range of a [`FfmpegSource`]. #[derive(Serialize_repr)] #[repr(u8)] +#[non_exhaustive] pub enum ColorRange { /// Automatic detection. Auto = 0, @@ -617,6 +623,7 @@ pub struct AvCaptureInputV2<'a> { /// Color space as part of an [`AvCaptureInputV2`]. #[derive(Serialize_repr)] #[repr(i8)] +#[non_exhaustive] pub enum ColorSpace { /// Automatic detection. Auto = -1, @@ -635,6 +642,7 @@ impl Default for ColorSpace { /// Video color range as part of an [`AvCaptureInputV2`]. #[derive(Serialize_repr)] #[repr(i8)] +#[non_exhaustive] pub enum VideoRange { /// Automatic detection. Auto = -1, @@ -652,6 +660,7 @@ impl Default for VideoRange { /// Different presets for the [`AvCaptureInputV2`]. #[derive(Serialize)] +#[non_exhaustive] pub enum AvPreset { /// Preset for resolution _3840x2160_ (may not be available). #[serde(rename = "AVCaptureSessionPreset3840x2160")] diff --git a/src/requests/custom/transitions.rs b/src/requests/custom/transitions.rs index 1bcc4e5..e1ac0bf 100644 --- a/src/requests/custom/transitions.rs +++ b/src/requests/custom/transitions.rs @@ -39,6 +39,7 @@ pub struct Slide { /// The direction for a [`Swipe`] or [`Slide]. #[derive(Clone, Copy, Debug, Serialize)] #[serde(rename_all = "lowercase")] +#[non_exhaustive] pub enum Direction { /// From/to the left. Left, @@ -79,6 +80,7 @@ pub struct Stinger<'a> { /// transition. #[derive(Clone, Copy, Debug, Serialize_repr)] #[repr(u8)] +#[non_exhaustive] pub enum TransitionPointType { /// Time in milliseconds. Time = 0, @@ -96,6 +98,7 @@ impl Default for TransitionPointType { /// locally or both at the same time. #[derive(Clone, Copy, Debug, Serialize_repr)] #[repr(u8)] +#[non_exhaustive] pub enum AudioMonitoring { /// No monitoring, means to insert the audio into the output stream but not playing it on the /// local machine. @@ -117,6 +120,7 @@ impl Default for AudioMonitoring { /// Describes the way in which the audio is faded between two scenes with a [`Stinger`] transition. #[derive(Clone, Copy, Debug, Serialize_repr)] #[repr(u8)] +#[non_exhaustive] pub enum AudioFadeStyle { /// Fade out to transition point then fade in. FadeOutFadeIn = 0, @@ -157,6 +161,7 @@ pub struct Wipe { /// A luma image that defines the animation of a [`Wipe`]. #[derive(Serialize)] +#[non_exhaustive] pub enum LumaImage { /// Barn door animation diagonal from the bottom left. #[serde(rename = "barndoor-botleft.png")] diff --git a/src/requests/inputs.rs b/src/requests/inputs.rs index f9c44b4..9795bb2 100644 --- a/src/requests/inputs.rs +++ b/src/requests/inputs.rs @@ -211,6 +211,7 @@ pub(crate) struct SetSettingsInternal<'a> { /// Request information for [`crate::client::Inputs::set_volume`]. #[derive(Serialize)] +#[non_exhaustive] pub enum Volume { /// Volume setting in mul. #[serde(rename = "inputVolumeMul")] diff --git a/src/requests/ui.rs b/src/requests/ui.rs index ea48922..9c8189b 100644 --- a/src/requests/ui.rs +++ b/src/requests/ui.rs @@ -87,6 +87,7 @@ pub(crate) struct OpenSourceProjectorInternal<'a> { /// Request information for [`crate::client::Ui::open_video_mix_projector`] as part of /// [`OpenVideoMixProjector`] and [`crate::client::Ui::open_source_projector`] as part of /// [`OpenSourceProjector`], describing the open location of the projector. +#[non_exhaustive] pub enum Location { /// Monitor index, passing `-1` opens the projector in windowed mode. MonitorIndex(i32), @@ -98,7 +99,7 @@ pub enum Location { /// [`OpenVideoMixProjector`] and [`crate::client::Ui::open_source_projector`] as part of /// [`OpenSourceProjector`], describing the open location of the projector. #[derive(Serialize)] -pub enum LocationInternal { +pub(crate) enum LocationInternal { /// Monitor index, passing `-1` opens the projector in windowed mode. #[serde(rename = "monitorIndex")] MonitorIndex(i32), @@ -119,6 +120,7 @@ impl From for LocationInternal { /// Request information for [`crate::client::Ui::open_video_mix_projector`] as part of /// [`OpenVideoMixProjector`], defining the type of video mix to open. #[derive(Serialize)] +#[non_exhaustive] pub enum VideoMixType { /// Show the preview scene. #[serde(rename = "OBS_WEBSOCKET_VIDEO_MIX_TYPE_PREVIEW")] diff --git a/src/responses/media_inputs.rs b/src/responses/media_inputs.rs index c364bc6..003eaa4 100644 --- a/src/responses/media_inputs.rs +++ b/src/responses/media_inputs.rs @@ -24,6 +24,7 @@ pub struct MediaStatus { #[derive( Clone, Copy, Debug, Default, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize, )] +#[non_exhaustive] pub enum MediaState { /// No state. #[default] diff --git a/src/responses/mod.rs b/src/responses/mod.rs index 84d365f..d1349ba 100644 --- a/src/responses/mod.rs +++ b/src/responses/mod.rs @@ -172,6 +172,7 @@ pub(crate) struct Status { Clone, Copy, Debug, Deserialize_repr, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize_repr, )] #[repr(u16)] +#[non_exhaustive] pub enum StatusCode { /// Unknown status, should never be used. Unknown = 0, @@ -269,6 +270,7 @@ pub enum StatusCode { Clone, Copy, Debug, Deserialize_repr, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize_repr, )] #[repr(u16)] +#[non_exhaustive] pub enum WebSocketCloseCode { /// Unknown reason, should never be used. UnknownReason = 4000, diff --git a/src/responses/scene_items.rs b/src/responses/scene_items.rs index ff07279..920062d 100644 --- a/src/responses/scene_items.rs +++ b/src/responses/scene_items.rs @@ -46,6 +46,7 @@ pub struct SceneItem { /// Kind of source that is represented by a [`SceneItem`]. #[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)] +#[non_exhaustive] pub enum SourceType { /// Input source from outside of OBS. #[serde(rename = "OBS_SOURCE_TYPE_INPUT")]