From dd7ae3467049c94407bbb948f02b15512cf91db5 Mon Sep 17 00:00:00 2001 From: Dimitri Sabadie Date: Sat, 27 Feb 2021 23:09:19 +0100 Subject: [PATCH] Remove __NonExhaustive and replace with #[non_exhaustive]. --- src/interpolation.rs | 15 +++++++++++---- src/spline.rs | 2 -- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/src/interpolation.rs b/src/interpolation.rs index 031e99b..15e7e42 100644 --- a/src/interpolation.rs +++ b/src/interpolation.rs @@ -6,9 +6,13 @@ use serde_derive::{Deserialize, Serialize}; /// Available kind of interpolations. /// /// Feel free to visit each variant for more documentation. +#[non_exhaustive] #[derive(Copy, Clone, Debug, Eq, PartialEq)] -#[cfg_attr(feature = "serialization", derive(Deserialize, Serialize))] -#[cfg_attr(feature = "serialization", serde(rename_all = "snake_case"))] +#[cfg_attr( + feature = "serialization", + derive(Deserialize, Serialize), + serde(rename_all = "snake_case") +)] pub enum Interpolation { /// Hold a [`Key`] until the sampling value passes the normalized step threshold, in which /// case the next key is used. @@ -20,12 +24,16 @@ pub enum Interpolation { /// /// [`Key`]: crate::key::Key Step(T), + /// Linear interpolation between a key and the next one. Linear, + /// Cosine interpolation between a key and the next one. Cosine, + /// Catmull-Rom interpolation, performing a cubic Hermite interpolation using four keys. CatmullRom, + /// Bézier interpolation. /// /// A control point that uses such an interpolation is associated with an extra point. The segmant @@ -41,6 +49,7 @@ pub enum Interpolation { /// point and the current control point’s associated point. This is called _quadratic Bézer /// interpolation_ and it kicks ass too, but a bit less than cubic. Bezier(V), + /// A special Bézier interpolation using an _input tangent_ and an _output tangent_. /// /// With this kind of interpolation, a control point has an input tangent, which has the same role @@ -53,8 +62,6 @@ pub enum Interpolation { /// /// Stroke Bézier interpolation is always a cubic Bézier interpolation by default. StrokeBezier(V, V), - #[doc(hidden)] - __NonExhaustive, } impl Default for Interpolation { diff --git a/src/spline.rs b/src/spline.rs index dd685b0..fc425d7 100644 --- a/src/spline.rs +++ b/src/spline.rs @@ -179,8 +179,6 @@ impl Spline { Some((value, cp0, Some(cp1))) } - - Interpolation::__NonExhaustive => unreachable!(), } }