pub trait IsIndexContainer: Clone + Default {
// Required methods
fn reserve(&mut self, n: usize);
fn ensure_supported(&mut self, x: usize);
fn len(&self) -> usize;
fn get(&self, index: usize) -> usize;
fn set(&mut self, index: usize, value: usize);
fn push(&mut self, value: usize);
fn iter(&self) -> IsIndexContainerIterator<'_, Self> ⓘ;
// Provided methods
fn with_capacity(n: usize) -> Self { ... }
fn with_support_for(x: usize) -> Self { ... }
fn with_capacity_and_support_for(n: usize, x: usize) -> Self { ... }
}
Expand description
IsIndexContainer trait for containers holding indices
Required Methods§
Sourcefn ensure_supported(&mut self, x: usize)
fn ensure_supported(&mut self, x: usize)
Should ensure that given number can be supported
Sourcefn iter(&self) -> IsIndexContainerIterator<'_, Self> ⓘ
fn iter(&self) -> IsIndexContainerIterator<'_, Self> ⓘ
Should return an iterator over the values
Provided Methods§
Sourcefn with_capacity(n: usize) -> Self
fn with_capacity(n: usize) -> Self
Creates a new object with the given capacity
Sourcefn with_support_for(x: usize) -> Self
fn with_support_for(x: usize) -> Self
Creates a new object that can support the given number
Sourcefn with_capacity_and_support_for(n: usize, x: usize) -> Self
fn with_capacity_and_support_for(n: usize, x: usize) -> Self
Creates a new object with the given capacity and support for the given number
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.