From 682206cf4ececb082e104c5c062beac40b229f7c Mon Sep 17 00:00:00 2001 From: amv-dev Date: Wed, 26 May 2021 11:21:38 +0500 Subject: [PATCH] chore: `Sequence` unimplemented methods now on first position --- src/core/sequence.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/core/sequence.rs b/src/core/sequence.rs index 0655727..d3fc993 100644 --- a/src/core/sequence.rs +++ b/src/core/sequence.rs @@ -8,6 +8,11 @@ pub trait Sequence: AsRef<[T]> { /// Validates the sequence. fn validate(&self) -> bool; + /// Calls [`Method`](crate::core::Method) over the slice and returns `Vec` of result values. + fn call<'a, M>(&self, method: M) -> Vec + where + M: Method<'a, Input = T> + BorrowMut + 'a; + /// Applies [`Method`](crate::core::Method) on the slice in-place. fn apply<'a, M>(&'a mut self, mut method: M) where @@ -18,11 +23,6 @@ pub trait Sequence: AsRef<[T]> { self.as_mut().iter_mut().for_each(|x| *x = method.next(*x)); } - /// Calls [`Method`](crate::core::Method) over the slice and returns `Vec` of result values. - fn call<'a, M>(&self, method: M) -> Vec - where - M: Method<'a, Input = T> + BorrowMut + 'a; - /// Returns a reference to the first value in the sequence or `None` if it's empty. fn get_initial_value(&self) -> Option<&T> { self.as_ref().first()