Library guide · API index and notation
This page is generated from the bundled library in this checkout. Signatures and adjacent source comments are reproduced below; the linked guide explains usage, storage, failures, and platform support.
import "core/slice"
Names used in signatures
Unqualified names denote this package’s types (including other source files in the same package), language built-ins, or generic parameters such as T. Qualified names use the import aliases below. These aliases belong to the library source; import a dependency yourself to use its alias in your program.
| Alias | Package | Source file |
|---|---|---|
mem |
core/mem |
slice.dodo |
SplitMut
Struct · Source
Compiler-recognized pair: only split_at_mut constructs it, and individual slice descriptors cannot be replaced. Consume it with
let slice.SplitMut{left, right} = partsfor independent exclusive views. The fields do not own T.
pub struct SplitMut<T> {
pub &mut[T] left
pub &mut[T] right
}
split_at_mut
Function · Source
Checked like subslice_mut: both boundary splits succeed; an invalid midpoint returns none. The source stays borrowed until both views expire.
pub fn split_at_mut<T>(data: &mut[T], mid: usize) -> Option<SplitMut<T>> from(data)
is_empty
Function · Source
Optional checked access. Returned views retain the source borrow.
pub fn is_empty<T>(data: &[T]) -> bool
get
Function · Source
pub fn get<T>(data: &[T], index: usize) -> Option<&T> from(data)
get_mut
Function · Source
pub fn get_mut<T>(data: &mut[T], index: usize) -> Option<&mut T> from(data)
first
Function · Source
pub fn first<T>(data: &[T]) -> Option<&T> from(data)
last
Function · Source
pub fn last<T>(data: &[T]) -> Option<&T> from(data)
subslice
Function · Source
pub fn subslice<T>(data: &[T], start: usize, end: usize) -> Option<&[T]> from(data)
subslice_mut
Function · Source
pub fn subslice_mut<T>(data: &mut[T], start: usize, end: usize) -> Option<&mut[T]> from(data)