Skip to content

Commit

Permalink
merge: add as_slice() method
Browse files Browse the repository at this point in the history
This was already possible using `merge.iter().as_slice()`, but I think
this is cleaner.
  • Loading branch information
scott2000 committed Nov 22, 2024
1 parent cd9049a commit f32ee24
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions lib/src/merge.rs
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,13 @@ impl<T> Merge<T> {
self.values.resize(num_sides * 2 - 1, value.clone());
}

/// Returns a slice containing the terms. The items will alternate between
/// positive and negative terms, starting with positive (since there's one
/// more of those).
pub fn as_slice(&self) -> &[T] {
&self.values
}

/// Returns an iterator over references to the terms. The items will
/// alternate between positive and negative terms, starting with
/// positive (since there's one more of those).
Expand Down

0 comments on commit f32ee24

Please sign in to comment.