Skip to content

Commit

Permalink
chore: Sequence unimplemented methods now on first position
Browse files Browse the repository at this point in the history
  • Loading branch information
amv-dev committed May 26, 2021
1 parent f096fb9 commit 682206c
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/core/sequence.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ pub trait Sequence<T>: 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<M::Output>
where
M: Method<'a, Input = T> + BorrowMut<M> + 'a;

/// Applies [`Method`](crate::core::Method) on the slice in-place.
fn apply<'a, M>(&'a mut self, mut method: M)
where
Expand All @@ -18,11 +23,6 @@ pub trait Sequence<T>: 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<M::Output>
where
M: Method<'a, Input = T> + BorrowMut<M> + '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()
Expand Down

0 comments on commit 682206c

Please sign in to comment.