#[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: u32Implementationsยง
Sourceยงimpl<T> Array<T>
impl<T> Array<T>
pub const NONE: Array<T>
pub const fn new(index: u32, len: u32) -> Array<T>
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 for Array<T>where
T: SlabItem,
impl<T> SlabItem for Array<T>where
T: SlabItem,
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
Sourceยงimpl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Sourceยงimpl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Sourceยงfn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Sourceยงfn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Sourceยงfn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Anyโs vtable from &Traitโs.Sourceยงfn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Anyโs vtable from &mut Traitโs.Sourceยงimpl<T> DowncastSync for T
impl<T> DowncastSync for T
Sourceยงimpl<T> Instrument for T
impl<T> Instrument for T
Sourceยงfn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Sourceยงfn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Sourceยงimpl<T> IntoEither for T
impl<T> IntoEither for T
Sourceยงfn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSourceยงfn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSourceยงimpl<T> Pointable for T
impl<T> Pointable for T
Sourceยงimpl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Sourceยงfn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
Read this value from the supplied reader. Same as
ReadEndian::read_from_little_endian().