From eca09f1baf6181dd64b401bc29165316b557a157 Mon Sep 17 00:00:00 2001 From: Gray Olson Date: Wed, 13 Sep 2023 15:52:43 +0200 Subject: [PATCH] add clear method to Spline --- src/spline.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/spline.rs b/src/spline.rs index 8d065eb..242eca6 100644 --- a/src/spline.rs +++ b/src/spline.rs @@ -55,6 +55,13 @@ impl Spline { spline.internal_sort(); spline } + + /// Clear the spline by removing all keys. Keeps the underlying allocated storage, so adding + /// new keys should be faster than creating a new [`Spline`] + #[inline] + pub fn clear(&mut self) { + self.0.clear() + } /// Create a new spline by consuming an `Iterater>`. They keys don’t have to be /// sorted.