mirror of
https://github.com/martinvonz/jj.git
synced 2025-02-06 03:22:59 +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());
|
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
|
/// Returns an iterator over references to the terms. The items will
|
||||||
/// alternate between positive and negative terms, starting with
|
/// alternate between positive and negative terms, starting with
|
||||||
/// positive (since there's one more of those).
|
/// positive (since there's one more of those).
|
||||||
|
|
Loading…
Reference in a new issue