Make all public enums non-exhaustive

pull/28/head
Dominik Nakamura 2 years ago
parent 35cf3d6c80
commit 0598091592
No known key found for this signature in database
GPG Key ID: E4C6A749B2491910

@ -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 {

@ -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<Alignment> 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]

@ -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")]

@ -55,6 +55,7 @@ pub type Result<T, E = Error> = std::result::Result<T, E>;
/// 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")]

@ -46,6 +46,7 @@ impl<'a> From<Request<'a>> 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")]

@ -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")]

@ -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")]

@ -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")]

@ -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<Location> 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")]

@ -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]

@ -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,

@ -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")]

Loading…
Cancel
Save