From bf0e1335255dc45ae67a51d3de3262484c4ed351 Mon Sep 17 00:00:00 2001 From: amv-dev Date: Fri, 4 Jun 2021 16:31:34 +0500 Subject: [PATCH] style: added [non_exhaustive] attribute to some enums: * Source; * Error; * RegularMethods. --- src/core/candles.rs | 1 + src/core/errors.rs | 1 + src/helpers/methods.rs | 1 + 3 files changed, 3 insertions(+) diff --git a/src/core/candles.rs b/src/core/candles.rs index dd6a884..f58e0ea 100644 --- a/src/core/candles.rs +++ b/src/core/candles.rs @@ -10,6 +10,7 @@ use crate::core::{Error, ValueType, OHLCV}; #[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd)] #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] #[cfg_attr(feature = "serde", serde(rename_all = "lowercase"))] +#[non_exhaustive] pub enum Source { /// *Close* part of a candle Close, diff --git a/src/core/errors.rs b/src/core/errors.rs index 2d0d1b4..6848fd9 100644 --- a/src/core/errors.rs +++ b/src/core/errors.rs @@ -1,5 +1,6 @@ /// Crate errors enum #[derive(Debug, Clone)] +#[non_exhaustive] pub enum Error { /// Error parsing string to [`Source`](crate::core::Source) SourceParse(String), diff --git a/src/helpers/methods.rs b/src/helpers/methods.rs index 31733a6..b5f7f9b 100644 --- a/src/helpers/methods.rs +++ b/src/helpers/methods.rs @@ -27,6 +27,7 @@ pub type RegularMethod = #[derive(Debug, Clone, Copy, PartialEq)] #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] #[cfg_attr(feature = "serde", serde(rename_all = "lowercase"))] +#[non_exhaustive] pub enum RegularMethods { /// [Simple Moving Average](crate::methods::SMA) SMA,