Remove __NonExhaustive and replace with #[non_exhaustive].

This commit is contained in:
Dimitri Sabadie 2021-02-27 23:09:19 +01:00
parent e1998fda56
commit dd7ae34670
No known key found for this signature in database
GPG Key ID: B313786A66884DCD
2 changed files with 11 additions and 6 deletions

View File

@ -6,9 +6,13 @@ use serde_derive::{Deserialize, Serialize};
/// Available kind of interpolations. /// Available kind of interpolations.
/// ///
/// Feel free to visit each variant for more documentation. /// Feel free to visit each variant for more documentation.
#[non_exhaustive]
#[derive(Copy, Clone, Debug, Eq, PartialEq)] #[derive(Copy, Clone, Debug, Eq, PartialEq)]
#[cfg_attr(feature = "serialization", derive(Deserialize, Serialize))] #[cfg_attr(
#[cfg_attr(feature = "serialization", serde(rename_all = "snake_case"))] feature = "serialization",
derive(Deserialize, Serialize),
serde(rename_all = "snake_case")
)]
pub enum Interpolation<T, V> { pub enum Interpolation<T, V> {
/// Hold a [`Key`] until the sampling value passes the normalized step threshold, in which /// Hold a [`Key`] until the sampling value passes the normalized step threshold, in which
/// case the next key is used. /// case the next key is used.
@ -20,12 +24,16 @@ pub enum Interpolation<T, V> {
/// ///
/// [`Key`]: crate::key::Key /// [`Key`]: crate::key::Key
Step(T), Step(T),
/// Linear interpolation between a key and the next one. /// Linear interpolation between a key and the next one.
Linear, Linear,
/// Cosine interpolation between a key and the next one. /// Cosine interpolation between a key and the next one.
Cosine, Cosine,
/// Catmull-Rom interpolation, performing a cubic Hermite interpolation using four keys. /// Catmull-Rom interpolation, performing a cubic Hermite interpolation using four keys.
CatmullRom, CatmullRom,
/// Bézier interpolation. /// Bézier interpolation.
/// ///
/// A control point that uses such an interpolation is associated with an extra point. The segmant /// A control point that uses such an interpolation is associated with an extra point. The segmant
@ -41,6 +49,7 @@ pub enum Interpolation<T, V> {
/// point and the current control points associated point. This is called _quadratic Bézer /// point and the current control points associated point. This is called _quadratic Bézer
/// interpolation_ and it kicks ass too, but a bit less than cubic. /// interpolation_ and it kicks ass too, but a bit less than cubic.
Bezier(V), Bezier(V),
/// A special Bézier interpolation using an _input tangent_ and an _output tangent_. /// 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 /// With this kind of interpolation, a control point has an input tangent, which has the same role
@ -53,8 +62,6 @@ pub enum Interpolation<T, V> {
/// ///
/// Stroke Bézier interpolation is always a cubic Bézier interpolation by default. /// Stroke Bézier interpolation is always a cubic Bézier interpolation by default.
StrokeBezier(V, V), StrokeBezier(V, V),
#[doc(hidden)]
__NonExhaustive,
} }
impl<T, V> Default for Interpolation<T, V> { impl<T, V> Default for Interpolation<T, V> {

View File

@ -179,8 +179,6 @@ impl<T, V> Spline<T, V> {
Some((value, cp0, Some(cp1))) Some((value, cp0, Some(cp1)))
} }
Interpolation::__NonExhaustive => unreachable!(),
} }
} }