#[repr(C)]pub struct Array<T> {
pub index: u32,
pub len: u32,
/* private fields */
}
Expand description
A pointer to contiguous T
elements in a slab.
use crabslab::{Array, CpuSlab, GrowableSlab, Id, Slab, SlabItem};
let ints = [1, 2, 3, 4, 5u32];
let mut slab = CpuSlab::new(vec![]);
let array = slab.append_array(&ints);
for (i, id) in array.iter().enumerate() {
let value = slab.read(id);
assert_eq!(ints[i], value);
}
Fields§
§index: u32
§len: u32
Implementations§
Source§impl<T> Array<T>
impl<T> Array<T>
pub const NONE: Self
pub const fn new(index: u32, len: u32) -> Self
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
pub fn is_null(&self) -> bool
pub fn contains_index(&self, index: usize) -> bool
pub fn at(&self, index: usize) -> Id<T>where
T: SlabItem,
pub fn starting_index(&self) -> usize
pub fn iter(&self) -> ArrayIter<T> ⓘ
Sourcepub fn into_u32_array(self) -> Array<u32>where
T: SlabItem,
pub fn into_u32_array(self) -> Array<u32>where
T: SlabItem,
Convert this array into a u32
array.
Trait Implementations§
Source§impl<T: SlabItem> SlabItem for Array<T>
impl<T: SlabItem> SlabItem for Array<T>
impl<T> Copy for Array<T>
Auto Trait Implementations§
impl<T> Freeze for Array<T>
impl<T> RefUnwindSafe for Array<T>where
T: RefUnwindSafe,
impl<T> Send for Array<T>where
T: Send,
impl<T> Sync for Array<T>where
T: Sync,
impl<T> Unpin for Array<T>where
T: Unpin,
impl<T> UnwindSafe for Array<T>where
T: 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