/std/slice/index.nct
index.nct
//! Public observation methods for array slices.
//!
//! `[T]` is a compiler built-in unsized type. Its public behavior is ordinary
//! source built on the narrow representation query below.
see ./ordering.nct
see ./views.nct
instance [T] {
/// Returns the number of elements in this slice.
pub noalloc method &self.len(): usize
/// Returns whether this slice contains no elements.
pub noalloc method &self.is_empty(): bool
/// Returns the non-owning address of the first element storage.
pub noalloc method &self.ptr(): *T
/// Returns a readonly element borrow, or `none` when `index` is out of bounds.
pub noalloc method &self.get(index: usize): &T?
/// Returns a readwrite element borrow, or `none` when `index` is out of bounds.
pub noalloc method &+self.get_mut(index: usize): &+T?
/// Returns the first element borrow, or `none` when the slice is empty.
pub noalloc method &self.first(): &T?
/// Compares elements from left to right without consuming either slice.
pub operator (&self == other: &Self): bool where (&T == &T): bool
/// Returns whether an equal element is present.
pub method &self.contains(expected: &T): bool where (&T == &T): bool
/// Returns the first index containing an equal element.
pub method &self.position(expected: &T): usize? where (&T == &T): bool
/// Orders elements lexicographically without consuming either slice.
pub operator (&self < other: &Self): bool where (&T < &T): bool
/// Orders elements in place without requesting auxiliary storage itself.
/// The selected `<` implementation may allocate.
/// Equivalent elements may move relative to one another.
pub method &+self.sort(): void where (&T < &T): bool
}