mirror of
https://github.com/martinvonz/jj.git
synced 2025-01-16 00:56:23 +00:00
merge: add as_slice()
method
This was already possible using `merge.iter().as_slice()`, but I think this is cleaner.
This commit is contained in:
parent
54c453ba8d
commit
ec6220d51f
1 changed files with 7 additions and 0 deletions
|
@ -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).
|
||||
|
|
Loading…
Reference in a new issue