make some enums non-exhaustive (#2140)

This commit is contained in:
Evan Almloff authored and GitHub committed 2024-03-26 19:14:48 -07:00
1 parent 460a685fa3
commit dadbab5d72
16 files changed
+28 -11

No files matched your search

+1
View File
@@ -155,6 +155,7 @@ impl Display for IssueReport {
}
#[derive(Debug, Clone, PartialEq, Eq)]
#[non_exhaustive]
#[allow(clippy::enum_variant_names)] // we'll add non-hook ones in the future
/// Issues that might be found via static analysis of a Dioxus file.
pub enum Issue {
+2
View File
@@ -6,6 +6,7 @@ use std::path::PathBuf;
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize, Debug)]
#[cfg_attr(feature = "cli", derive(clap::ValueEnum))]
#[non_exhaustive]
pub enum Platform {
/// Targeting the web platform using WASM
#[cfg_attr(feature = "cli", clap(name = "web"))]
@@ -57,6 +58,7 @@ impl std::fmt::Display for LoadDioxusConfigError {
impl std::error::Error for LoadDioxusConfigError {}
#[derive(Debug)]
#[non_exhaustive]
pub enum CrateConfigError {
Cargo(CargoError),
Io(std::io::Error),
+1
View File
@@ -105,6 +105,7 @@ impl Build {
)?
}
}
_ => unreachable!(),
};
let temp = gen_page(&crate_config, build_result.assets.as_ref(), false);
+1
View File
@@ -68,6 +68,7 @@ impl Serve {
Platform::Web => web::startup(crate_config.clone(), &serve_cfg).await?,
Platform::Desktop => desktop::startup(crate_config.clone(), &serve_cfg).await?,
Platform::Fullstack => fullstack::startup(crate_config.clone(), &serve_cfg).await?,
_ => unreachable!(),
}
Ok(())
+1
View File
@@ -7,6 +7,7 @@ use crate::menubar::{default_menu_bar, DioxusMenu};
/// The behaviour of the application when the last window is closed.
#[derive(Copy, Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum WindowCloseBehaviour {
/// Default behaviour, closing the last window exits the app
LastWindowExitsApp,
+1
View File
@@ -254,6 +254,7 @@ impl<V: DeserializeOwned> Drop for Query<V> {
}
#[derive(Error, Debug)]
#[non_exhaustive]
pub enum QueryError {
#[error("Error receiving query result.")]
Recv,
@@ -163,6 +163,7 @@ impl server_fn::ServerFunctionRegistry<()> for DioxusServerFnRegistry {
#[cfg_attr(docsrs, doc(cfg(feature = "server")))]
/// Errors that can occur when registering a server function.
#[derive(thiserror::Error, Debug, Clone, serde::Serialize, serde::Deserialize)]
#[non_exhaustive]
pub enum ServerRegistrationFnError {
/// The server function is already registered.
#[error("The server function {0} is already registered")]
+1
View File
@@ -131,6 +131,7 @@ impl IntoFuture for UseEval {
/// Represents an error when evaluating JavaScript
#[derive(Debug)]
#[non_exhaustive]
pub enum EvalError {
/// The platform does not support evaluating JavaScript.
Unsupported,
+1
View File
@@ -114,6 +114,7 @@ pub type MountedResult<T> = Result<T, MountedError>;
#[derive(Debug)]
/// The error type for the MountedData
#[non_exhaustive]
pub enum MountedError {
/// The renderer does not support the requested operation
NotSupported,
+1
View File
@@ -26,6 +26,7 @@ pub trait WebsocketRx: StreamExt<Item = Result<String, LiveViewError>> {}
impl<T> WebsocketRx for T where T: StreamExt<Item = Result<String, LiveViewError>> {}
#[derive(Debug, thiserror::Error)]
#[non_exhaustive]
pub enum LiveViewError {
#[error("Sending to client error")]
SendingFailed,
+1
View File
@@ -260,6 +260,7 @@ impl<V: DeserializeOwned> Drop for Query<V> {
}
#[derive(Error, Debug)]
#[non_exhaustive]
pub enum QueryError {
#[error("Error receiving query result: {0}")]
Recv(RecvError),
+1
View File
@@ -343,6 +343,7 @@ impl SiteMapSegment {
/// The type of a route segment.
#[derive(Debug, Clone, PartialEq)]
#[non_exhaustive]
pub enum SegmentType {
/// A static route segment.
Static(&'static str),
+1 -1
View File
@@ -15,7 +15,7 @@ pub struct StringChain {
}
#[derive(Debug, Clone, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub enum Segment {
pub(crate) enum Segment {
Attr(usize),
Node(usize),
PreRendered(String),
+1
View File
@@ -272,6 +272,7 @@ impl DerefMut for WriteBuffer {
/// An error that can occur while rendering a route or retrieving a cached route.
#[derive(Debug, thiserror::Error)]
#[non_exhaustive]
pub enum IncrementalRendererError {
/// An formatting error occurred while rendering a route.
#[error("RenderError: {0}")]
+1
View File
@@ -5,6 +5,7 @@ use dioxus_core::WriteMutations;
use dioxus_core::{DynamicNode, ElementId, ScopeState, TemplateNode, VNode, VirtualDom};
#[derive(Debug)]
#[non_exhaustive]
pub enum RehydrationError {
VNodeNotInitialized,
}