Skip to main content

Column

Struct Column 

Source
pub struct Column<T: Copy + Default> { /* private fields */ }

Implementations§

Source§

impl<T: Copy + Default> Column<T>

Source

pub fn new(size: usize) -> Self

Source

pub fn from_vec(data: Vec<T>) -> Self

Source

pub fn get(&self, id: u32) -> T

value of a slot (column[id]). out of range reads return the default value (undefined -> 0)

Source

pub fn set(&self, id: u32, value: T)

write a slot (column[id] = value). out of range writes are ignored, like typed arrays

Source

pub fn len(&self) -> usize

Source

pub fn is_empty(&self) -> bool

Source

pub fn resize(&self, size: usize)

grow the column, the new slots are zeroed

Source

pub fn replace(&self, data: Vec<T>) -> Vec<T>

replace the data

Source

pub fn to_vec(&self) -> Vec<T>

copy of the data

Source

pub fn as_ptr(&self) -> *const T

pointer to the data, for the javascript typed array views. valid until the next resize / replace

Source

pub fn as_mut_ptr(&self) -> *mut T

mutable pointer to the data, for the javascript typed array views

Auto Trait Implementations§

§

impl<T> !Freeze for Column<T>

§

impl<T> !RefUnwindSafe for Column<T>

§

impl<T> !Sync for Column<T>

§

impl<T> Forget for Column<T>

§

impl<T> Move for Column<T>

§

impl<T> Send for Column<T>
where UnsafeCell<Vec<T>>: Send, UnsafeCell<Vec<Vec<T>>>: Send,

§

impl<T> Unpin for Column<T>

§

impl<T> UnsafeUnpin for Column<T>

§

impl<T> UnwindSafe for Column<T>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.