Struct andex::AndexableArray
source · pub struct AndexableArray<A, Item, const SIZE: usize>(/* private fields */);Expand description
Array wrapper indexable by the provided Andex type.
Example:
use andex::*;
enum MyIdxMarker {}
type MyIdx = Andex<MyIdxMarker, 12>;
// Create the array wrapper:
type MyU32 = AndexableArray<MyIdx, u32, { MyIdx::SIZE }>;
// We can create other arrays with the same Andex type:
type MyF64 = AndexableArray<MyIdx, f64, { MyIdx::SIZE }>;
// Create a default array:
let myu32 = MyU32::default();
// Print the first element:
const first : MyIdx = MyIdx::new::<0>();
println!("{:?}", myu32[first]);
// Iterate and print all elements:
for i in MyIdx::iter() {
println!("{:?}", myu32[i]);
}
// Print the whole array
println!("{:?}", myu32);Implementations§
Trait Implementations§
source§impl<A, Item, const SIZE: usize> AsMut<[Item; SIZE]> for AndexableArray<A, Item, SIZE>
impl<A, Item, const SIZE: usize> AsMut<[Item; SIZE]> for AndexableArray<A, Item, SIZE>
source§fn as_mut(&mut self) -> &mut [Item; SIZE]
fn as_mut(&mut self) -> &mut [Item; SIZE]
Converts this type into a mutable reference of the (usually inferred) input type.
source§impl<A, Item, const SIZE: usize> AsRef<[Item; SIZE]> for AndexableArray<A, Item, SIZE>
impl<A, Item, const SIZE: usize> AsRef<[Item; SIZE]> for AndexableArray<A, Item, SIZE>
source§fn as_ref(&self) -> &[Item; SIZE]
fn as_ref(&self) -> &[Item; SIZE]
Converts this type into a shared reference of the (usually inferred) input type.
source§impl<A, Item, const SIZE: usize> From<&[Item; SIZE]> for AndexableArray<A, Item, SIZE>where
Item: Copy,
impl<A, Item, const SIZE: usize> From<&[Item; SIZE]> for AndexableArray<A, Item, SIZE>where
Item: Copy,
source§fn from(array: &[Item; SIZE]) -> Self
fn from(array: &[Item; SIZE]) -> Self
Converts to this type from the input type.
source§impl<A, Item, const SIZE: usize> From<&AndexableArray<A, Item, SIZE>> for [Item; SIZE]where
Item: Copy,
impl<A, Item, const SIZE: usize> From<&AndexableArray<A, Item, SIZE>> for [Item; SIZE]where
Item: Copy,
source§fn from(andexable_array: &AndexableArray<A, Item, SIZE>) -> [Item; SIZE]
fn from(andexable_array: &AndexableArray<A, Item, SIZE>) -> [Item; SIZE]
Converts to this type from the input type.
source§impl<A, Item, const SIZE: usize> From<[Item; SIZE]> for AndexableArray<A, Item, SIZE>
impl<A, Item, const SIZE: usize> From<[Item; SIZE]> for AndexableArray<A, Item, SIZE>
source§fn from(array: [Item; SIZE]) -> Self
fn from(array: [Item; SIZE]) -> Self
Converts to this type from the input type.
source§impl<A, Item, const SIZE: usize> From<AndexableArray<A, Item, SIZE>> for [Item; SIZE]where
Item: Copy,
impl<A, Item, const SIZE: usize> From<AndexableArray<A, Item, SIZE>> for [Item; SIZE]where
Item: Copy,
source§fn from(andexable_array: AndexableArray<A, Item, SIZE>) -> [Item; SIZE]
fn from(andexable_array: AndexableArray<A, Item, SIZE>) -> [Item; SIZE]
Converts to this type from the input type.
source§impl<'a, A, Item: 'a + Copy, const SIZE: usize> FromIterator<&'a Item> for AndexableArray<A, Item, SIZE>
impl<'a, A, Item: 'a + Copy, const SIZE: usize> FromIterator<&'a Item> for AndexableArray<A, Item, SIZE>
source§impl<A, Item, const SIZE: usize> FromIterator<Item> for AndexableArray<A, Item, SIZE>
impl<A, Item, const SIZE: usize> FromIterator<Item> for AndexableArray<A, Item, SIZE>
source§fn from_iter<I: IntoIterator<Item = Item>>(intoiter: I) -> Self
fn from_iter<I: IntoIterator<Item = Item>>(intoiter: I) -> Self
Creates a value from an iterator. Read more
source§impl<A, Item, const SIZE: usize> Index<&Andex<A, SIZE>> for AndexableArray<Andex<A, SIZE>, Item, SIZE>
impl<A, Item, const SIZE: usize> Index<&Andex<A, SIZE>> for AndexableArray<Andex<A, SIZE>, Item, SIZE>
source§impl<A, Item, const SIZE: usize> Index<Andex<A, SIZE>> for AndexableArray<Andex<A, SIZE>, Item, SIZE>
impl<A, Item, const SIZE: usize> Index<Andex<A, SIZE>> for AndexableArray<Andex<A, SIZE>, Item, SIZE>
source§impl<A, Item, const SIZE: usize> IndexMut<&Andex<A, SIZE>> for AndexableArray<Andex<A, SIZE>, Item, SIZE>
impl<A, Item, const SIZE: usize> IndexMut<&Andex<A, SIZE>> for AndexableArray<Andex<A, SIZE>, Item, SIZE>
source§impl<A, Item, const SIZE: usize> IndexMut<Andex<A, SIZE>> for AndexableArray<Andex<A, SIZE>, Item, SIZE>
impl<A, Item, const SIZE: usize> IndexMut<Andex<A, SIZE>> for AndexableArray<Andex<A, SIZE>, Item, SIZE>
source§impl<'a, A, Item, const SIZE: usize> IntoIterator for &'a AndexableArray<A, Item, SIZE>
impl<'a, A, Item, const SIZE: usize> IntoIterator for &'a AndexableArray<A, Item, SIZE>
source§impl<'a, A, Item, const SIZE: usize> IntoIterator for &'a mut AndexableArray<A, Item, SIZE>
impl<'a, A, Item, const SIZE: usize> IntoIterator for &'a mut AndexableArray<A, Item, SIZE>
impl<A, Item: Copy, const SIZE: usize> Copy for AndexableArray<A, Item, SIZE>
Auto Trait Implementations§
impl<A, Item, const SIZE: usize> Freeze for AndexableArray<A, Item, SIZE>where
Item: Freeze,
impl<A, Item, const SIZE: usize> RefUnwindSafe for AndexableArray<A, Item, SIZE>where
A: RefUnwindSafe,
Item: RefUnwindSafe,
impl<A, Item, const SIZE: usize> Send for AndexableArray<A, Item, SIZE>
impl<A, Item, const SIZE: usize> Sync for AndexableArray<A, Item, SIZE>
impl<A, Item, const SIZE: usize> Unpin for AndexableArray<A, Item, SIZE>
impl<A, Item, const SIZE: usize> UnwindSafe for AndexableArray<A, Item, SIZE>where
A: UnwindSafe,
Item: UnwindSafe,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more