### Iter Example Source: https://docs.rs/slice-utils/2.2.1/slice_utils/trait.SliceBorrowed.html?search=std%3A%3Avec Demonstrates creating an iterator over the slice. ```rust let slice = [1, 2].chain([3]); let mut iter = slice.iter(); assert_eq!(iter.next(), Some(&1)); assert_eq!(iter.next(), Some(&2)); assert_eq!(iter.next(), Some(&3)); assert!(iter.next().is_none()); ``` -------------------------------- ### Windows Example Source: https://docs.rs/slice-utils/2.2.1/slice_utils/trait.SliceBorrowed.html?search=std%3A%3Avec Demonstrates using windows to iterate over overlapping slices. ```rust let slice = [1, 2, 3, 4, 5]; let mut windows = slice.windows(3); assert_eq!(windows.next().unwrap(), [1, 2, 3]); assert_eq!(windows.next().unwrap(), [2, 3, 4]); assert_eq!(windows.next().unwrap(), [3, 4, 5]); assert!(windows.next().is_none()); assert_eq!(windows.get_owned(1).unwrap(), [2, 3, 4]); ``` -------------------------------- ### Map Example Source: https://docs.rs/slice-utils/2.2.1/slice_utils/trait.SliceBorrowed.html?search=std%3A%3Avec Demonstrates using map to transform elements within the slice. ```rust let slice = [0, 1, 2].map(|x| x != 0); assert_eq!(slice, [false, true, true]); ``` -------------------------------- ### Array Windows Example Source: https://docs.rs/slice-utils/2.2.1/slice_utils/trait.SliceBorrowed.html?search=std%3A%3Avec Demonstrates using array_windows to iterate over overlapping fixed-size arrays. ```rust let slice = [1, 2, 3, 4, 5]; let mut windows = slice.array_windows::<3>(); assert_eq!(windows.next(), Some([&1, &2, &3])); assert_eq!(windows.next(), Some([&2, &3, &4])); assert_eq!(windows.next(), Some([&3, &4, &5])); assert!(windows.next().is_none()); assert_eq!(windows.get_owned(1), Some([&2, &3, &4])); ``` -------------------------------- ### try_array Example Source: https://docs.rs/slice-utils/2.2.1/slice_utils/trait.SliceOwned.html Collect the slice into an array, failing if lengths do not match. ```rust let slice = [1, 2, 3].map(|i| i * i); let arr: [i32; 3] = slice.try_array().unwrap(); assert_eq!(arr, [1, 4, 9]); ``` -------------------------------- ### Chunks Example Source: https://docs.rs/slice-utils/2.2.1/slice_utils/trait.SliceBorrowed.html?search=std%3A%3Avec Demonstrates using chunks to iterate over consecutive portions of the slice. ```rust let slice = [1, 2, 3, 4, 5]; let mut iter = slice.chunks(2); assert_eq!(iter.next().unwrap(), [1, 2]); assert_eq!(iter.next().unwrap(), [3, 4]); assert_eq!(iter.next().unwrap(), [5]); assert!(iter.next().is_none()); ``` -------------------------------- ### zip Example Source: https://docs.rs/slice-utils/2.2.1/slice_utils/trait.SliceOwned.html Zip two slices into a single slice where indexing returns a tuple of items. ```rust let a = [1, 2, 3]; let b = [4, 5, 6, 7]; let slice = a.zip(b); assert_eq!( slice, [ (1, 4), (2, 5), (3, 6), ] ); ``` -------------------------------- ### Cloned Example Source: https://docs.rs/slice-utils/2.2.1/slice_utils/trait.SliceBorrowed.html?search=std%3A%3Avec Demonstrates using cloned to create a new slice that clones values on access. ```rust struct Foo(u32); impl Clone for Foo { fn clone(&self) -> Foo { Foo(self.0 + 1) } } let slice = [Foo(1), Foo(2)]; assert_eq!(slice.cloned(), [Foo(2), Foo(3)]); ``` -------------------------------- ### Using contiguous_mut Source: https://docs.rs/slice-utils/2.2.1/slice_utils/trait.ContiguousMut.html Example demonstrating how to retrieve and modify the contiguous backing of a vector. ```rust let mut a = [1, 2, 3].to_vec(); let b = a.contiguous_mut(); b.copy_from_slice(&[4, 5, 6]); // method on core::slice assert_eq!(a, [4, 5, 6]); ``` -------------------------------- ### Array Chunks Example Source: https://docs.rs/slice-utils/2.2.1/slice_utils/trait.SliceBorrowed.html?search=std%3A%3Avec Demonstrates using array_chunks to iterate over non-overlapping fixed-size arrays. ```rust let slice = [1, 2, 3, 4, 5]; let mut iter = slice.array_chunks::<2>(); assert_eq!(iter.next(), Some([&1, &2])); assert_eq!(iter.next(), Some([&3, &4])); assert!(iter.next().is_none()); assert_eq!(iter.remainder(), [5]); ``` -------------------------------- ### Use ContiguousBorrowed Example Source: https://docs.rs/slice-utils/2.2.1/slice_utils/trait.ContiguousBorrowed.html Demonstrates retrieving the contiguous backing of a vector. ```rust let a = [1, 2, 3].to_vec(); let b = a.contiguous(); assert_eq!(a, b); ``` -------------------------------- ### array_chunks Example Source: https://docs.rs/slice-utils/2.2.1/slice_utils/trait.SliceOwned.html Iterate over arrays covering consecutive portions of the slice. Panics if N is 0. ```rust let slice = [1, 2, 3, 4, 5]; let mut iter = slice.array_chunks::<2>(); assert_eq!(iter.next(), Some([1, 2])); assert_eq!(iter.next(), Some([3, 4])); assert!(iter.next().is_none()); assert_eq!(iter.remainder(), [5]); ``` -------------------------------- ### fn get_with R, R>(&self, index: usize, f: &mut W) -> Option Source: https://docs.rs/slice-utils/2.2.1/slice_utils/trait.Slice.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Retrieves an element at the specified index and applies a transformation function to it, returning the result wrapped in an Option. ```APIDOC ## fn get_with R, R>(&self, index: usize, f: &mut W) -> Option ### Description Accesses the element at the given index and applies the provided closure `f` to it. If the index is within bounds, it returns `Some(result)`, otherwise it returns `None`. ### Parameters - **index** (usize) - The index of the element to retrieve. - **f** (&mut W) - A mutable reference to a closure that transforms the element of type `Self::Output` into type `R`. ### Returns - **Option** - The result of the transformation if the index is valid, otherwise `None`. ``` -------------------------------- ### FromFn::new Source: https://docs.rs/slice-utils/2.2.1/slice_utils/struct.FromFn.html Creates a new instance of FromFn from a closure and an optional length. ```APIDOC ## pub fn new(f: F, len: Option) -> Self ### Description Creates a slice from a closure. The closure `f` is called with an index and should return `Some(T)` if the index is valid, or `None` otherwise. ### Parameters - **f** (F) - The closure used to generate elements at specific indices. - **len** (Option) - The optional length of the slice. ``` -------------------------------- ### WindowsOwned::new Source: https://docs.rs/slice-utils/2.2.1/slice_utils/struct.WindowsOwned.html Creates a new WindowsOwned iterator for the given slice and window size. ```APIDOC ## pub fn new(data: &'a S, size: usize) -> Self ### Description Creates a new iterator over overlapping windows of a slice. ### Parameters - **data** (&'a S) - The slice underlying the iterator. - **size** (usize) - The size of the windows. ### Returns - **Self** - A new instance of WindowsOwned. ``` -------------------------------- ### WindowsOwned::eq Source: https://docs.rs/slice-utils/2.2.1/slice_utils/struct.WindowsOwned.html?search=u32+-%3E+bool Compares a WindowsOwned instance with another object for equality. ```APIDOC ## fn eq(&self, other: &O) -> bool ### Description Compares the WindowsOwned instance with another object to determine equality. ### Signature `fn eq(&WindowsOwned, &O) -> bool` ### Parameters - **other** (&O) - The object to compare against. ``` -------------------------------- ### fn get_with R, R>(&self, index: usize, f: &mut W) -> Option Source: https://docs.rs/slice-utils/2.2.1/slice_utils/trait.Slice.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Accesses an element at a specific index by passing it to a closure, returning the closure's result or None if the index is out of bounds. ```APIDOC ## fn get_with R, R>(&self, index: usize, f: &mut W) -> Option ### Description Call a closure with the indicated element, returning the result or `None` if the index was out-of-bounds. This allows operations that are independent of the specific indexing method. ### Parameters - **index** (usize) - The index of the element to access. - **f** (&mut W) - A mutable closure that takes a reference to the slice's output type and returns a value. ### Returns - **Option** - The result of the closure wrapped in Some, or None if the index is invalid. ``` -------------------------------- ### from_fn(f: F, len: Option) -> FromFn Source: https://docs.rs/slice-utils/2.2.1/slice_utils/fn.from_fn.html Creates a slice by calling a closure on the index. The closure receives the index and returns an Option. ```APIDOC ## from_fn ### Description Creates a slice by calling a closure on the index. This is analogous to `core::iter::from_fn`. ### Signature `pub fn from_fn(f: F, len: Option) -> FromFn` ### Parameters - **f** (F) - A closure that takes a `usize` index and returns an `Option`. - **len** (Option) - An optional length for the resulting slice. ### Example ```rust let slice = slice_utils::from_fn(|i| Some(i * i), Some(5)); assert_eq!(slice, [0, 1, 4, 9, 16]); ``` ``` -------------------------------- ### from_fn(f: F, len: Option) -> FromFn Source: https://docs.rs/slice-utils/2.2.1/slice_utils/fn.from_fn.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Creates a slice by calling a closure on the index. The closure receives the index and returns an Option. ```APIDOC ## Function: from_fn ### Description Creates a slice by calling a closure on the index. This is analogous to `core::iter::from_fn`. ### Signature `pub fn from_fn(f: F, len: Option) -> FromFn` ### Parameters - **f** (F) - A closure that takes a `usize` index and returns an `Option`. - **len** (Option) - The optional length of the resulting slice. ### Example ```rust let slice = slice_utils::from_fn(|i| Some(i * i), Some(5)); assert_eq!(slice, [0, 1, 4, 9, 16]); ``` ``` -------------------------------- ### from_fn(f: F, len: Option) -> FromFn Source: https://docs.rs/slice-utils/2.2.1/slice_utils/fn.from_fn.html?search= Creates a slice by calling a closure on the index. The closure receives the index and returns an Option. ```APIDOC ## Function: from_fn ### Description A slice made by calling a closure on the index. Analogous to `core::iter::from_fn`. ### Signature `pub fn from_fn(f: F, len: Option) -> FromFn` ### Parameters - **f** (F) - A closure that takes a `usize` index and returns `Option`. - **len** (Option) - The optional length of the resulting slice. ### Example ```rust let slice = slice_utils::from_fn(|i| Some(i * i), Some(5)); assert_eq!(slice, [0, 1, 4, 9, 16]); ``` ``` -------------------------------- ### fn copy_from_slice(&mut self, src: &S) Source: https://docs.rs/slice-utils/2.2.1/slice_utils/trait.SliceMut.html?search=std%3A%3Avec Copies all elements from a source slice into the current slice. ```APIDOC ### fn copy_from_slice(&mut self, src: &S) #### Description Copies all items from the source slice 'src' into 'self'. The lengths of the two slices must match, otherwise the operation will panic. #### Parameters - **src** (&S) - Required - The source slice to copy data from. ``` -------------------------------- ### ArrayWindowsBorrowed::new Source: https://docs.rs/slice-utils/2.2.1/slice_utils/struct.ArrayWindowsBorrowed.html?search=std%3A%3Avec Creates a new instance of ArrayWindowsBorrowed for the given slice. ```APIDOC ## pub fn new(data: &'a S) -> Self ### Description Creates a new iterator over overlapping windows of a slice. This is typically invoked via `SliceBorrowed::array_windows`. ### Parameters - **data** (&'a S) - The inner slice to iterate over. ``` -------------------------------- ### slice Source: https://docs.rs/slice-utils/2.2.1/slice_utils/trait.Slice.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Creates a sub-slice. ```APIDOC ## fn slice>(self, range: R) -> Option> ### Description Create a sub-slice of the slice. Analagous to slicing &[T]. ``` -------------------------------- ### from_fn(f: F, len: Option) -> FromFn Source: https://docs.rs/slice-utils/2.2.1/slice_utils/fn.from_fn.html?search=std%3A%3Avec Creates a slice by calling a closure on the index. The closure is called for each index up to the specified length. ```APIDOC ## Function: from_fn ### Description Creates a slice by calling a closure on the index. This is analogous to `core::iter::from_fn`. ### Signature `pub fn from_fn(f: F, len: Option) -> FromFn` where `F: Fn(usize) -> Option` ### Parameters - **f** (F) - A closure that takes an index (usize) and returns an Option. - **len** (Option) - The optional length of the resulting slice. ### Example ```rust let slice = slice_utils::from_fn(|i| Some(i * i), Some(5)); assert_eq!(slice, [0, 1, 4, 9, 16]); ``` ``` -------------------------------- ### fn eq(&self, other: &O) -> bool Source: https://docs.rs/slice-utils/2.2.1/slice_utils/struct.WindowsOwned.html?search=u32+-%3E+bool Tests for equality between the current WindowsOwned instance and another object, typically invoked via the == operator. ```APIDOC ## fn eq(&self, other: &O) -> bool ### Description Tests for `self` and `other` values to be equal, and is used by the `==` operator. ### Parameters - **other** (&O) - Required - The object to compare against the current instance. ``` -------------------------------- ### Create a slice using from_fn Source: https://docs.rs/slice-utils/2.2.1/slice_utils/fn.from_fn.html Generates a slice of a specified length by applying a closure to each index. ```rust let slice = slice_utils::from_fn(|i| Some(i * i), Some(5)); assert_eq!(slice, [0, 1, 4, 9, 16]); ``` -------------------------------- ### fn len(&self) -> usize Source: https://docs.rs/slice-utils/2.2.1/slice_utils/trait.Slice.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Returns the number of elements available in the slice. ```APIDOC ## fn len(&self) -> usize ### Description Returns the total number of elements contained within the slice. ### Returns - **usize** - The length of the slice. ``` -------------------------------- ### IterOwned::new Source: https://docs.rs/slice-utils/2.2.1/slice_utils/struct.IterOwned.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Creates a new instance of IterOwned from a given slice. ```APIDOC ## pub fn new(data: S) -> Self ### Description Creates a new iterator from the provided slice data. ### Parameters - **data** (S) - Required - The inner slice to iterate over. ``` -------------------------------- ### WindowsBorrowed::new Source: https://docs.rs/slice-utils/2.2.1/slice_utils/struct.WindowsBorrowed.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Creates a new WindowsBorrowed iterator over the provided slice with the specified window size. ```APIDOC ## pub fn new(data: &'a S, size: usize) -> Self ### Description Creates a new instance of WindowsBorrowed, which iterates over overlapping windows of the given slice. ### Parameters - **data** (&'a S) - The slice underlying the iterator. - **size** (usize) - The size of each window. ``` -------------------------------- ### fn split_mut(&mut self, at: usize) -> Option<(SplitMut<'_, Self>, SplitMut<'_, Self>)> Source: https://docs.rs/slice-utils/2.2.1/slice_utils/trait.SliceMut.html?search=std%3A%3Avec Splits the slice into two mutable parts at the given index. ```APIDOC ### fn split_mut(&mut self, at: usize) -> Option<(SplitMut<'_, Self>, SplitMut<'_, Self>)> #### Description Returns two mutable slices: one containing elements before the index 'at', and one containing elements from 'at' onwards. Requires the type to implement the Unique trait. #### Parameters - **at** (usize) - Required - The index at which to split the slice. ``` -------------------------------- ### slice_utils::from_fn Source: https://docs.rs/slice-utils/2.2.1/slice_utils/fn.from_fn.html?search=u32+-%3E+bool Creates a slice by calling a closure on the index. The closure receives the index and returns an Option. ```APIDOC ## fn from_fn(f: F, len: Option) -> FromFn ### Description A slice made by calling a closure on the index. Analogous to `core::iter::from_fn`. ### Parameters - **f** (F) - Required - A closure that takes a usize index and returns an Option. - **len** (Option) - Required - The optional length of the resulting slice. ### Example ```rust let slice = slice_utils::from_fn(|i| Some(i * i), Some(5)); assert_eq!(slice, [0, 1, 4, 9, 16]); ``` ``` -------------------------------- ### fn len(&self) -> usize Source: https://docs.rs/slice-utils/2.2.1/slice_utils/trait.Slice.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Returns the total number of elements contained within the slice. ```APIDOC ## fn len(&self) -> usize ### Description Returns the length of the slice. ### Returns - **usize** - The number of elements in the slice. ``` -------------------------------- ### slice Source: https://docs.rs/slice-utils/2.2.1/slice_utils/trait.Slice.html?search=u32+-%3E+bool Create a sub-slice of the slice. ```APIDOC ## fn slice>(self, range: R) -> Option> ### Description Create a sub-slice of the slice. Analagous to slicing `&[T]`. ``` -------------------------------- ### get_with Source: https://docs.rs/slice-utils/2.2.1/slice_utils/struct.WindowsOwned.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Call a closure with the indicated element, returning the result or None if the index was out-of-bounds. ```APIDOC ## fn get_with R, R>(&self, index: usize, f: &mut W) -> Option Executes the provided closure on the element at the specified index. Returns the result wrapped in Some, or None if the index is invalid. ``` -------------------------------- ### fn any(&mut self, f: F) -> bool Source: https://docs.rs/slice-utils/2.2.1/slice_utils/struct.ArrayWindowsOwned.html?search=u32+-%3E+bool Tests if any element of the iterator matches a predicate. ```APIDOC ## fn any(&mut self, f: F) -> bool ### Description Tests if any element of the iterator matches a predicate. ``` -------------------------------- ### Iterator Methods Source: https://docs.rs/slice-utils/2.2.1/slice_utils/struct.ArrayWindowsOwned.html?search=std%3A%3Avec A collection of methods for iterating, searching, and transforming elements. ```APIDOC ## fn try_fold(&mut self, init: B, f: F) -> R ### Description An iterator method that applies a function as long as it returns successfully, producing a single, final value. ## fn try_for_each(&mut self, f: F) -> R ### Description An iterator method that applies a fallible function to each item in the iterator, stopping at the first error and returning that error. ## fn fold(self, init: B, f: F) -> B ### Description Folds every element into an accumulator by applying an operation, returning the final result. ## fn reduce(self, f: F) -> Option ### Description Reduces the elements to a single one, by repeatedly applying a reducing operation. ## fn all(&mut self, f: F) -> bool ### Description Tests if every element of the iterator matches a predicate. ## fn any(&mut self, f: F) -> bool ### Description Tests if any element of the iterator matches a predicate. ## fn find

(&mut self, predicate: P) -> Option ### Description Searches for an element of an iterator that satisfies a predicate. ## fn max(self) -> Option ### Description Returns the maximum element of an iterator. ## fn min(self) -> Option ### Description Returns the minimum element of an iterator. ``` -------------------------------- ### fold Source: https://docs.rs/slice-utils/2.2.1/slice_utils/struct.ArrayWindowsOwned.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Folds every element into an accumulator by applying an operation. ```APIDOC ## fn fold(self, init: B, f: F) -> B ### Description Folds every element into an accumulator by applying an operation, returning the final result. ``` -------------------------------- ### try_array Source: https://docs.rs/slice-utils/2.2.1/slice_utils/struct.Cycle.html?search=std%3A%3Avec Tries to collect the slice into an array. ```APIDOC ## fn try_array(&self) -> Option<[Self::Output; N]> ### Description Try to collect the slice into an array, failing if the lengths don’t match up. ``` -------------------------------- ### IterBorrowed::new Source: https://docs.rs/slice-utils/2.2.1/slice_utils/struct.IterBorrowed.html?search= Creates a new instance of IterBorrowed for the provided slice. ```APIDOC ## pub fn new(data: &'a S) -> Self ### Description Creates a new iterator for the given slice. See `SliceBorrowed::iter` for usage context. ### Parameters - **data** (&'a S) - Required - The slice to iterate over. ``` -------------------------------- ### IterBorrowed::new Source: https://docs.rs/slice-utils/2.2.1/slice_utils/struct.IterBorrowed.html?search=std%3A%3Avec Creates a new instance of IterBorrowed for the provided slice. ```APIDOC ## fn new(data: &'a S) -> Self ### Description Creates a new iterator for the given slice. ### Parameters - **data** (&'a S) - Required - The slice to iterate over. ``` -------------------------------- ### fn unzip(self) -> (FromA, FromB) Source: https://docs.rs/slice-utils/2.2.1/slice_utils/struct.ArrayChunksBorrowed.html?search=std%3A%3Avec Converts an iterator of pairs into a pair of containers. ```APIDOC ## fn unzip(self) -> (FromA, FromB) ### Description Converts an iterator of pairs into a pair of containers. ``` -------------------------------- ### Iterator Comparison Methods Source: https://docs.rs/slice-utils/2.2.1/slice_utils/struct.IterOwned.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Methods for comparing two iterators for equality, inequality, or lexicographical order. ```APIDOC ## fn eq_by(self, other: I, eq: F) -> bool Determines if the elements of this Iterator are equal to those of another with respect to the specified equality function. ## fn ne(self, other: I) -> bool Determines if the elements of this Iterator are not equal to those of another. ## fn lt(self, other: I) -> bool Determines if the elements of this Iterator are lexicographically less than those of another. ## fn le(self, other: I) -> bool Determines if the elements of this Iterator are lexicographically less or equal to those of another. ## fn gt(self, other: I) -> bool Determines if the elements of this Iterator are lexicographically greater than those of another. ## fn ge(self, other: I) -> bool Determines if the elements of this Iterator are lexicographically greater than or equal to those of another. ``` -------------------------------- ### fn ne(&self, other: &Rhs) -> bool Source: https://docs.rs/slice-utils/2.2.1/slice_utils/struct.WindowsOwned.html?search=u32+-%3E+bool Tests for inequality between the current WindowsOwned instance and another object, typically invoked via the != operator. ```APIDOC ## fn ne(&self, other: &Rhs) -> bool ### Description Tests for inequality between `self` and `other`, used by the `!=` operator. ### Parameters - **other** (&Rhs) - Required - The object to compare against the current instance. ``` -------------------------------- ### chain Source: https://docs.rs/slice-utils/2.2.1/slice_utils/trait.Slice.html?search=u32+-%3E+bool Chains two slices together, back-to-back. ```APIDOC ## fn chain>(self, other: S) -> Chain ### Description Chains two slices together, back-to-back. Analagous to `Iterator::chain`. ``` -------------------------------- ### fn all(&mut self, f: F) -> bool Source: https://docs.rs/slice-utils/2.2.1/slice_utils/struct.ArrayWindowsOwned.html?search=u32+-%3E+bool Tests if every element of the iterator matches a predicate. ```APIDOC ## fn all(&mut self, f: F) -> bool ### Description Tests if every element of the iterator matches a predicate. ``` -------------------------------- ### Create a sub-slice Source: https://docs.rs/slice-utils/2.2.1/slice_utils/trait.Slice.html Creates a sub-slice based on the provided range bounds. ```rust let slice = [1, 2, 3, 4, 5].slice(1..4).unwrap(); assert_eq!(slice, [2, 3, 4]); ``` -------------------------------- ### len Source: https://docs.rs/slice-utils/2.2.1/slice_utils/struct.WindowsOwned.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Returns the length of the slice. ```APIDOC ## fn len(&self) -> usize Returns the number of elements in the slice. ``` -------------------------------- ### cycle Source: https://docs.rs/slice-utils/2.2.1/slice_utils/trait.Slice.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Cycles the slice infinitely. ```APIDOC ## fn cycle(self) -> Cycle ### Description Cycles the slice infinitely. Analagous to Iterator::cycle. ``` -------------------------------- ### cycle Source: https://docs.rs/slice-utils/2.2.1/slice_utils/trait.Slice.html?search=u32+-%3E+bool Cycles the slice infinitely. ```APIDOC ## fn cycle(self) -> Cycle ### Description Cycles the slice infinitely. Analagous to `Iterator::cycle`. ``` -------------------------------- ### fn position

(&mut self, predicate: P) -> Option Source: https://docs.rs/slice-utils/2.2.1/slice_utils/struct.ArrayWindowsOwned.html?search=u32+-%3E+bool Searches for an element in an iterator, returning its index. ```APIDOC ## fn position

(&mut self, predicate: P) -> Option ### Description Searches for an element in an iterator, returning its index. ``` -------------------------------- ### Access Elements with get_with Source: https://docs.rs/slice-utils/2.2.1/slice_utils/trait.Slice.html Demonstrates using get_with to perform operations on slice elements without requiring specific ownership semantics. ```rust let a = [1_i32, 2, 3]; // Doesn't care about ownership fn stringify_first(slice: &S) -> String where S: Slice, S::Output: ToString, { slice.get_with(0, &mut |x| x.to_string()).unwrap_or_default() } assert_eq!(stringify_first(&a), "1"); ``` -------------------------------- ### zip Source: https://docs.rs/slice-utils/2.2.1/slice_utils/struct.Cycle.html?search=std%3A%3Avec Zips two slices into a single slice. ```APIDOC ## fn zip(self, other: O) -> Zip ### Description Zip two slices into a single slice, where indexing returns a tuple of their items. ``` -------------------------------- ### fn get_mut(&mut self, index: usize) -> Option<&mut Self::Output> Source: https://docs.rs/slice-utils/2.2.1/slice_utils/trait.SliceMut.html?search=std%3A%3Avec Indexes the slice and returns a mutable reference to the value at the specified index, if it exists. ```APIDOC ### fn get_mut(&mut self, index: usize) -> Option<&mut Self::Output> #### Description Indexes the slice, returning a mutably borrowed value at the given index. Returns None if the index is out of bounds. #### Parameters - **index** (usize) - Required - The index of the element to retrieve. ``` -------------------------------- ### Create a new ChunksBorrowed iterator Source: https://docs.rs/slice-utils/2.2.1/slice_utils/struct.ChunksBorrowed.html?search= Constructor for creating a new instance of the iterator. ```rust pub fn new(data: &'a S, size: usize) -> Self ``` -------------------------------- ### is_empty Source: https://docs.rs/slice-utils/2.2.1/slice_utils/struct.WindowsOwned.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Returns whether or not the slice is empty. ```APIDOC ## fn is_empty(&self) -> bool Returns true if the slice contains no elements. ``` -------------------------------- ### split Source: https://docs.rs/slice-utils/2.2.1/slice_utils/trait.Slice.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Splits the slice at a given index. ```APIDOC ## fn split(&self, at: usize) -> Option<(SliceOf<&Self>, SliceOf<&Self>)> ### Description Returns (&self[..at], &self[at..]). Returns None if at is out-of-bounds. Analagous to slice::split. ``` -------------------------------- ### split Source: https://docs.rs/slice-utils/2.2.1/slice_utils/trait.Slice.html?search=u32+-%3E+bool Splits the slice at a given index. ```APIDOC ## fn split(&self, at: usize) -> Option<(SliceOf<&Self>, SliceOf<&Self>)> ### Description Returns `(&self[..at], &self[at..])`. Returns `None` if `at` is out-of-bounds. Analagous to `slice::split`. ``` -------------------------------- ### SliceOf::new Source: https://docs.rs/slice-utils/2.2.1/slice_utils/struct.SliceOf.html Creates a new sub-slice from a given data source and range. ```APIDOC ## pub fn new>(data: A, range: R) -> Option ### Description Creates a sub-slice of the provided data based on the specified range. ### Parameters - **data** (A) - Required - The source slice implementation. - **range** (R) - Required - The range bounds to slice the data. ### Returns - **Option** - Returns the new SliceOf instance if the range is valid, otherwise None. ``` -------------------------------- ### chain Source: https://docs.rs/slice-utils/2.2.1/slice_utils/trait.Slice.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Chains two slices together. ```APIDOC ## fn chain>(self, other: S) -> Chain ### Description Chains two slices together, back-to-back. Analagous to Iterator::chain. ``` -------------------------------- ### from_fn Function Signature Source: https://docs.rs/slice-utils/2.2.1/slice_utils/fn.from_fn.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E The function signature for from_fn, requiring a closure that returns an Option and an optional length. ```rust pub fn from_fn(f: F, len: Option) -> FromFn where F: Fn(usize) -> Option, ``` -------------------------------- ### SliceOf::new Source: https://docs.rs/slice-utils/2.2.1/slice_utils/struct.SliceOf.html?search= Creates a new sub-slice from the provided data and range. ```APIDOC ## fn new>(data: A, range: R) -> Option ### Description Creates a sub-slice of the provided data based on the specified range. ### Parameters - **data** (A) - The source slice to create a sub-slice from. - **range** (R) - The range bounds to slice the data by. ### Returns - **Option** - Returns the new SliceOf instance, or None if the range is out-of-bounds. ``` -------------------------------- ### copy_from_slice Source: https://docs.rs/slice-utils/2.2.1/slice_utils/trait.SliceMut.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Copies all elements from a source slice into the current slice. ```APIDOC ## fn copy_from_slice(&mut self, src: &S) where S: Slice, S::Output: Clone ### Description Copies all items from the source slice into the current slice. Panics if the lengths of the slices do not match. ``` -------------------------------- ### SliceOf::new Source: https://docs.rs/slice-utils/2.2.1/slice_utils/struct.SliceOf.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Creates a new sub-slice from the provided data within the specified range. ```APIDOC ## fn new>(data: A, range: R) -> Option ### Description Creates a sub-slice of the provided data based on the given range bounds. ### Parameters - **data** (A) - The source slice data. - **range** (R) - The range bounds for the sub-slice. ### Returns - **Option** - Returns the new SliceOf instance, or None if the range is invalid. ``` -------------------------------- ### SliceOf::new Source: https://docs.rs/slice-utils/2.2.1/slice_utils/struct.SliceOf.html?search=std%3A%3Avec Creates a new sub-slice from the provided data within the specified range. ```APIDOC ## fn new>(data: A, range: R) -> Option ### Description Creates a sub-slice of the provided data based on the given range bounds. ### Parameters - **data** (A) - The source slice data. - **range** (R) - The range bounds for the sub-slice. ### Returns - **Option** - Returns the new SliceOf instance if the range is valid, otherwise None. ``` -------------------------------- ### rev Source: https://docs.rs/slice-utils/2.2.1/slice_utils/trait.Slice.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Reverses the slice. ```APIDOC ## fn rev(self) -> Reverse ### Description Reverses the slice. Analagous to Iterator::rev. ``` -------------------------------- ### rev Source: https://docs.rs/slice-utils/2.2.1/slice_utils/trait.Slice.html?search=u32+-%3E+bool Reverses the slice. ```APIDOC ## fn rev(self) -> Reverse ### Description Reverses the slice. Analagous to `Iterator::rev`. ``` -------------------------------- ### iter Source: https://docs.rs/slice-utils/2.2.1/slice_utils/struct.Cycle.html?search=std%3A%3Avec Creates an iterator over the slice. ```APIDOC ## fn iter(self) -> IterOwned ### Description Creates an iterator over the slice. ``` -------------------------------- ### SplitMut::new Source: https://docs.rs/slice-utils/2.2.1/slice_utils/struct.SplitMut.html?search= Creates a new mutable split of the provided slice at the specified index. ```APIDOC ## fn new(data: &mut A, at: usize) -> Option<(Self, Self)> ### Description Creates a mutable split of the slice at the given index. Returns an Option containing a tuple of two SplitMut instances if the index is within bounds, otherwise returns None. ### Parameters - **data** (&mut A) - The mutable slice to be split. - **at** (usize) - The index at which to split the slice. ``` -------------------------------- ### map Source: https://docs.rs/slice-utils/2.2.1/slice_utils/struct.Cycle.html?search=std%3A%3Avec Calls a closure on index, returning a new type. ```APIDOC ## fn map R, R>(self, f: F) -> MapOwned ### Description Call a closure on index, returning a new type. ``` -------------------------------- ### fn find

(&mut self, predicate: P) -> Option Source: https://docs.rs/slice-utils/2.2.1/slice_utils/struct.ArrayWindowsOwned.html?search=u32+-%3E+bool Searches for an element of an iterator that satisfies a predicate. ```APIDOC ## fn find

(&mut self, predicate: P) -> Option ### Description Searches for an element of an iterator that satisfies a predicate. ``` -------------------------------- ### Create a new SplitMut Source: https://docs.rs/slice-utils/2.2.1/slice_utils/struct.SplitMut.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Creates a mutable split of the slice at the specified index. ```rust pub fn new(data: &mut A, at: usize) -> Option<(Self, Self)> ``` -------------------------------- ### windows Source: https://docs.rs/slice-utils/2.2.1/slice_utils/struct.Cycle.html?search=std%3A%3Avec Returns a slice/iterator over slices covering overlapping portions of the slice. ```APIDOC ## fn windows(&self, size: usize) -> WindowsOwned<'_, Self> ### Description Return a slice/iterator over slices covering overlapping portions of the slice. ``` -------------------------------- ### ChunksBorrowed::new Source: https://docs.rs/slice-utils/2.2.1/slice_utils/struct.ChunksBorrowed.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Creates a new ChunksBorrowed iterator for the given slice and chunk size. ```APIDOC ## pub fn new(data: &'a S, size: usize) -> Self ### Description Creates a new iterator over overlapping chunks of a slice. ### Parameters - **data** (&'a S) - The slice underlying the iterator. - **size** (usize) - The size of the chunks to iterate over. ``` -------------------------------- ### Split a slice mutably Source: https://docs.rs/slice-utils/2.2.1/slice_utils/trait.SliceMut.html?search= Demonstrates splitting a slice into two mutable parts at a specific index. ```rust let mut slice = [1, 2, 3, 4, 5]; let (mut left, mut right) = SliceMut::split_mut(&mut slice, 2).unwrap(); assert_eq!(left, [1, 2, 3]); assert_eq!(right, [4, 5]); left[0] = 0; right[0] = 0; assert_eq!(slice, [0, 2, 3, 0, 5]); ``` -------------------------------- ### Chain two slices Source: https://docs.rs/slice-utils/2.2.1/slice_utils/trait.Slice.html Chains two slices together back-to-back, similar to Iterator::chain. ```rust let a = [1, 2, 3]; let b = [4, 5, 6]; assert_eq!(a.chain(b), [1, 2, 3, 4, 5, 6]); ``` -------------------------------- ### IterBorrowed::new Source: https://docs.rs/slice-utils/2.2.1/slice_utils/struct.IterBorrowed.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Creates a new instance of the IterBorrowed iterator for a given slice. ```APIDOC ## fn new(data: &'a S) -> Self ### Description Creates a new iterator for the provided slice. This is typically accessed via `SliceBorrowed::iter`. ### Parameters - **data** (&'a S) - Required - The slice to iterate over. ``` -------------------------------- ### try_fold Source: https://docs.rs/slice-utils/2.2.1/slice_utils/struct.ArrayWindowsOwned.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Applies a function as long as it returns successfully, producing a single, final value. ```APIDOC ## fn try_fold(&mut self, init: B, f: F) -> R ### Description An iterator method that applies a function as long as it returns successfully, producing a single, final value. ``` -------------------------------- ### fn array_chunks(self) -> ArrayChunks Source: https://docs.rs/slice-utils/2.2.1/slice_utils/struct.ArrayChunksBorrowed.html?search=std%3A%3Avec Returns an iterator over N elements of the iterator at a time. This is a nightly-only experimental API. ```APIDOC ## fn array_chunks(self) -> ArrayChunks ### Description Returns an iterator over N elements of the iterator at a time. This is a nightly-only experimental API (`iter_array_chunks`). ### Parameters - **N** (usize) - The size of the chunks to produce. ``` -------------------------------- ### Define SplitMut struct Source: https://docs.rs/slice-utils/2.2.1/slice_utils/struct.SplitMut.html The definition of the SplitMut struct. ```rust pub struct SplitMut<'a, A: ?Sized> { /* private fields */ } ``` -------------------------------- ### fn contiguous(&self) -> &[Self::Output] Source: https://docs.rs/slice-utils/2.2.1/slice_utils/trait.ContiguousBorrowed.html Returns the contiguous backing of the slice. The returned slice is guaranteed to behave identically to the original slice regarding element access. ```APIDOC ## fn contiguous(&self) -> &[Self::Output] ### Description Retrieves the contiguous memory representation of the implementing type. The returned slice should be functionally equivalent to the original structure. ### Signature `fn contiguous(&self) -> &[Self::Output]` ### Example ```rust let a = [1, 2, 3].to_vec(); let b = a.contiguous(); assert_eq!(a, b); ``` ``` -------------------------------- ### array_windows Source: https://docs.rs/slice-utils/2.2.1/slice_utils/struct.Cycle.html?search=std%3A%3Avec Returns an iterator over arrays covering overlapping portions of the slice. ```APIDOC ## fn array_windows(self) -> ArrayWindowsOwned ### Description Return a slice/iterator over arrays covering overlapping portions of the slice. ``` -------------------------------- ### get_owned Source: https://docs.rs/slice-utils/2.2.1/slice_utils/struct.Cycle.html?search=std%3A%3Avec Indexes the slice and returns an owned value. ```APIDOC ## fn get_owned(&self, index: usize) -> Option ### Description Indexes the slice, returning an owned value at the specified index. ``` -------------------------------- ### ChunksOwned::new Source: https://docs.rs/slice-utils/2.2.1/slice_utils/struct.ChunksOwned.html Creates a new instance of the ChunksOwned iterator for a given slice and chunk size. ```APIDOC ## pub fn new(data: &'a S, size: usize) -> Self ### Description Creates a new iterator over overlapping chunks of a slice. ### Parameters - **data** (&'a S) - Required - The slice underlying the iterator. - **size** (usize) - Required - The size of the chunks to iterate over. ``` -------------------------------- ### IterOwned::new Source: https://docs.rs/slice-utils/2.2.1/slice_utils/struct.IterOwned.html?search= Creates a new instance of the IterOwned iterator for the provided slice data. ```APIDOC ## pub fn new(data: S) -> Self ### Description Creates a new iterator over the provided slice data. ### Parameters - **data** (S) - Required - The slice data to iterate over. ``` -------------------------------- ### reduce Source: https://docs.rs/slice-utils/2.2.1/slice_utils/struct.ArrayWindowsOwned.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Reduces the elements to a single one by repeatedly applying a reducing operation. ```APIDOC ## fn reduce(self, f: F) -> Option ### Description Reduces the elements to a single one, by repeatedly applying a reducing operation. ``` -------------------------------- ### Auto Trait Implementations for ChunksOwned Source: https://docs.rs/slice-utils/2.2.1/slice_utils/struct.ChunksOwned.html Lists the auto trait implementations for the ChunksOwned struct, including Freeze, RefUnwindSafe, Send, Sync, Unpin, UnsafeUnpin, and UnwindSafe. ```rust impl<'a, S> Freeze for ChunksOwned<'a, S> where S: ?Sized, ``` ```rust impl<'a, S> RefUnwindSafe for ChunksOwned<'a, S> where S: RefUnwindSafe + ?Sized, ``` ```rust impl<'a, S> Send for ChunksOwned<'a, S> where S: Sync + ?Sized, ``` ```rust impl<'a, S> Sync for ChunksOwned<'a, S> where S: Sync + ?Sized, ``` ```rust impl<'a, S> Unpin for ChunksOwned<'a, S> where S: ?Sized, ``` ```rust impl<'a, S> UnsafeUnpin for ChunksOwned<'a, S> where S: ?Sized, ``` ```rust impl<'a, S> UnwindSafe for ChunksOwned<'a, S> where S: RefUnwindSafe + ?Sized, ``` -------------------------------- ### Split a slice Source: https://docs.rs/slice-utils/2.2.1/slice_utils/trait.Slice.html Splits a slice at a given index into two parts, returning None if the index is out of bounds. ```rust let slice = [1, 2, 3, 4, 5, 6]; let (a, b) = slice.split(3).unwrap(); assert_eq!(a, [1, 2, 3]); assert_eq!(b, [4, 5, 6]); ``` -------------------------------- ### Cycle Methods Source: https://docs.rs/slice-utils/2.2.1/slice_utils/struct.Cycle.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Methods available for the Cycle struct to manipulate and iterate over slice data. ```APIDOC ## fn get_owned(&self, index: usize) -> Option Index the slice, returning an owned value. ## fn array_chunks(self) -> ArrayChunksOwned Return an iterator over arrays covering consecutive portions of the slice. ## fn array_windows(self) -> ArrayWindowsOwned Return a slice/iterator over arrays covering overlapping portions of the slice. ## fn chunks(&self, size: usize) -> ChunksOwned<'_, Self> Return an iterator over slices covering consecutive portions of the slice. ## fn map R, R>(self, f: F) -> MapOwned Call a closure on index, returning a new type. ## fn iter(self) -> IterOwned Creates an iterator over the slice. ## fn try_array(&self) -> Option<[Self::Output; N]> Try to collect the slice into an array, failing if the lengths don’t match up. ## fn windows(&self, size: usize) -> WindowsOwned<'_, Self> Return a slice/iterator over slices covering overlapping portions of the slice. ## fn zip(self, other: O) -> Zip Zip two slices into a single slice, where indexing returns a tuple of their items. ``` -------------------------------- ### Iterator Sorting Check Methods Source: https://docs.rs/slice-utils/2.2.1/slice_utils/struct.IterOwned.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Methods to verify if the elements of an iterator are sorted. ```APIDOC ## fn is_sorted(self) -> bool Checks if the elements of this iterator are sorted. ## fn is_sorted_by(self, compare: F) -> bool Checks if the elements of this iterator are sorted using the given comparator function. ## fn is_sorted_by_key(self, f: F) -> bool Checks if the elements of this iterator are sorted using the given key extraction function. ``` -------------------------------- ### fn is_sorted_by_key(self, f: F) -> bool Source: https://docs.rs/slice-utils/2.2.1/slice_utils/struct.ArrayChunksOwned.html?search= Checks if the elements of this iterator are sorted using the given key extraction function. ```APIDOC ## fn is_sorted_by_key(self, f: F) -> bool ### Description Checks if the elements of this iterator are sorted using the given key extraction function. ### Parameters - **f** (F) - A closure that maps an item to a key that implements PartialOrd. ``` -------------------------------- ### fn is_sorted_by_key(self, f: F) -> bool Source: https://docs.rs/slice-utils/2.2.1/slice_utils/struct.ArrayChunksBorrowed.html?search= Checks if the elements of this iterator are sorted using the given key extraction function. ```APIDOC ## fn is_sorted_by_key(self, f: F) -> bool ### Description Checks if the elements of this iterator are sorted using the given key extraction function. ### Parameters - **f** (F) - Required - A closure that maps an item to a key that implements PartialOrd. ``` -------------------------------- ### interleave Source: https://docs.rs/slice-utils/2.2.1/slice_utils/trait.Slice.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Interleaves two slices. ```APIDOC ## fn interleave>(self, other: S) -> Interleave ### Description Interleaves two slices, e.g. [A, B, A, B, ...]. ``` -------------------------------- ### interleave Source: https://docs.rs/slice-utils/2.2.1/slice_utils/trait.Slice.html?search=u32+-%3E+bool Interleaves two slices. ```APIDOC ## fn interleave>( self, other: S, ) -> Interleave ### Description Interleaves two slices, e.g. [A, B, A, B, …]. ``` -------------------------------- ### interleave Source: https://docs.rs/slice-utils/2.2.1/slice_utils/trait.Slice.html?search= Interleaves two slices. ```APIDOC ## fn interleave>(self, other: S) -> Interleave ### Description Interleaves two slices, e.g. [A, B, A, B, …]. ``` -------------------------------- ### Define ArrayWindowsBorrowed struct Source: https://docs.rs/slice-utils/2.2.1/slice_utils/struct.ArrayWindowsBorrowed.html?search= The definition of the ArrayWindowsBorrowed struct, which holds a reference to a slice. ```rust pub struct ArrayWindowsBorrowed<'a, S: ?Sized, const N: usize> { pub data: &'a S, /* private fields */ } ``` -------------------------------- ### Cycle a slice Source: https://docs.rs/slice-utils/2.2.1/slice_utils/trait.Slice.html Creates an infinite cycle of the slice elements, similar to Iterator::cycle. ```rust let slice = [1, 2, 3].cycle(); assert_eq!(slice.get_owned(2), Some(3)); assert_eq!(slice.get_owned(4), Some(2)); assert_eq!(slice.get_owned(6), Some(1)); ``` -------------------------------- ### Reverse Struct Definition Source: https://docs.rs/slice-utils/2.2.1/slice_utils/struct.Reverse.html The primary definition of the Reverse struct. ```rust pub struct Reverse(pub S); ``` -------------------------------- ### Zip Struct Definition Source: https://docs.rs/slice-utils/2.2.1/slice_utils/struct.Zip.html The definition of the Zip struct containing two generic slice types. ```rust pub struct Zip(pub S1, pub S2); ``` -------------------------------- ### ArrayChunksBorrowed::new Source: https://docs.rs/slice-utils/2.2.1/slice_utils/struct.ArrayChunksBorrowed.html?search=u32+-%3E+bool Creates a new instance of the ArrayChunksBorrowed iterator. ```APIDOC ## pub fn new(data: &'a S) -> Self ### Description Creates a new iterator over overlapping chunks of the provided slice. ### Parameters - **data** (&'a S) - The slice underlying the iterator. ``` -------------------------------- ### IterOwned::new Source: https://docs.rs/slice-utils/2.2.1/slice_utils/struct.IterOwned.html Creates a new instance of an IterOwned iterator from a given slice-like data structure. ```APIDOC ## fn new(data: S) -> Self ### Description Creates a new iterator for the provided slice-like data structure. ### Parameters - **data** (S) - Required - The inner slice or slice-like data to iterate over. ``` -------------------------------- ### SliceBorrowed::get Source: https://docs.rs/slice-utils/2.2.1/slice_utils/trait.SliceBorrowed.html?search=std%3A%3Avec Retrieves an element at the specified index from a slice-like structure. ```APIDOC ## fn get(&self, index: usize) -> Option<&Self::Output> ### Description Returns a reference to the element at the given index if it exists within the bounds of the structure. ### Parameters - **index** (usize) - The position of the element to retrieve. ### Returns - **Option<&Self::Output>** - Returns Some(&element) if the index is valid, otherwise None. ``` -------------------------------- ### Copy from another slice Source: https://docs.rs/slice-utils/2.2.1/slice_utils/trait.SliceMut.html?search= Copies elements from a source slice into a mutable slice, requiring matching lengths. ```rust let mut x = [1, 2, 3, 4, 5]; let y = [6, 7]; (&mut x).slice(3..).unwrap().copy_from_slice(&y); assert_eq!(x, [1, 2, 3, 6, 7]); ``` -------------------------------- ### chunks Source: https://docs.rs/slice-utils/2.2.1/slice_utils/struct.Cycle.html?search=std%3A%3Avec Returns an iterator over slices covering consecutive portions of the slice. ```APIDOC ## fn chunks(&self, size: usize) -> ChunksOwned<'_, Self> ### Description Return an iterator over slices covering consecutive portions of the slice. ``` -------------------------------- ### try_for_each Source: https://docs.rs/slice-utils/2.2.1/slice_utils/struct.ArrayWindowsOwned.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Applies a fallible function to each item in the iterator, stopping at the first error. ```APIDOC ## fn try_for_each(&mut self, f: F) -> R ### Description An iterator method that applies a fallible function to each item in the iterator, stopping at the first error and returning that error. ``` -------------------------------- ### sum(self) -> S Source: https://docs.rs/slice-utils/2.2.1/slice_utils/struct.WindowsBorrowed.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Sums the elements of an iterator. ```APIDOC ## fn sum(self) -> S ### Description Sums the elements of an iterator. ```