From bc329fe736d1906b85a22ae186ae3b81a0dca5a7 Mon Sep 17 00:00:00 2001 From: Dimitri Sabadie Date: Sat, 13 Apr 2019 20:56:59 +0200 Subject: [PATCH] Migrate to Rust 2018. --- Cargo.toml | 2 ++ src/lib.rs | 10 +++++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 55317ca..67fdab5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -11,6 +11,8 @@ repository = "https://github.com/phaazon/splines" documentation = "https://docs.rs/splines" readme = "README.md" +edition = "2018" + [badges] travis-ci = { repository = "phaazon/splines", branch = "master" } is-it-maintained-issue-resolution = { repository = "phaazon/splines" } diff --git a/src/lib.rs b/src/lib.rs index fb3f59e..4f44e42 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -61,6 +61,7 @@ //! assert_eq!(spline.clamped_sample(-0.9), 0.); // clamped to the first key //! assert_eq!(spline.clamped_sample(1.1), 10.); // clamped to the last key //! ``` +//! //! # Features and customization //! //! This crate was written with features baked in and hidden behind feature-gates. The idea is that @@ -231,13 +232,15 @@ impl Spline { let cp1 = &keys[i+1]; let nt = normalize_time(t, cp0, cp1); Some(if nt < threshold { cp0.value } else { cp1.value }) - }, + } + Interpolation::Linear => { let cp1 = &keys[i+1]; let nt = normalize_time(t, cp0, cp1); Some(Interpolate::lerp(cp0.value, cp1.value, nt)) - }, + } + Interpolation::Cosine => { let cp1 = &keys[i+1]; let nt = normalize_time(t, cp0, cp1); @@ -255,7 +258,8 @@ impl Spline { }; Some(Interpolate::lerp(cp0.value, cp1.value, cos_nt)) - }, + } + Interpolation::CatmullRom => { // We need at least four points for Catmull Rom; ensure we have them, otherwise, return // None.