Compare commits
3 Commits
890174fd3e
...
cf7216939b
Author | SHA1 | Date |
---|---|---|
Leonora Tindall | cf7216939b | |
Leonora Tindall | c07306e2ae | |
Leonora Tindall | 3349bf2652 |
|
@ -8,4 +8,8 @@ license = "MIT"
|
|||
keywords = ["memory", "slice", "array"]
|
||||
categories = ["data-structures"]
|
||||
repository = "https://git.nora.codes/nora/nslice"
|
||||
readme = "README.md"
|
||||
|
||||
|
||||
[features]
|
||||
nightly = []
|
||||
default = ["nightly"]
|
14
src/lib.rs
14
src/lib.rs
|
@ -83,6 +83,20 @@ impl<T, const N: usize> MinSlice<T, N> {
|
|||
MinSlice::<T, M>::from_mut(self.as_mut_slice())
|
||||
}
|
||||
|
||||
/// Extend the `MinSlice`, returning a new `Some(&MinSlice<T, N + I>)`
|
||||
/// if there are at least `I` `T`s in `tail`.
|
||||
#[cfg(feature = "nightly")]
|
||||
pub fn extend_by<const I: usize>(&self) -> Option<&MinSlice<T, {N + I}>> {
|
||||
MinSlice::<T, {N + I}>::from_slice(self.as_slice())
|
||||
}
|
||||
|
||||
/// Extend the `MinSlice`, returning a new `Some(&mut MinSlice<T, N + I>)`
|
||||
/// if there are at least `I` `T`s in `tail`.
|
||||
#[cfg(feature = "nightly")]
|
||||
pub fn extend_by_mut<const I: usize>(&mut self) -> Option<&mut MinSlice<T, {N + I}>> {
|
||||
MinSlice::<T, {N + I}>::from_mut(self.as_mut_slice())
|
||||
}
|
||||
|
||||
/// Get a reference to a value from the `MinSlice` by index.
|
||||
///
|
||||
/// Return `Some(&T)` for the `T` at index `i` if `i < (N + self.tail.len)`,
|
||||
|
|
Loading…
Reference in New Issue