Struct Row

Source
pub struct Row(/* private fields */);
Expand description

A row that can contain a dynamic number of columns as long as each column has a distinct type

Implementations§

Source§

impl Row

Source

pub fn new<V: RowLike>(value: V) -> Row

creates a new empty row

Source

pub fn len(&self) -> usize

number of columns in this row

Source

pub fn is_empty(&self) -> bool

return true if thios row has no columns

Source

pub fn contains<T: Data>(&self) -> bool

return true if this row contains the given type

Source

pub fn upsert<T: Data>(&mut self, value: T) -> Option<T>

update or insert the given column, return the old value

Source

pub fn upsert_cell(&mut self, value: Box<dyn Cell>) -> Option<Box<dyn Any>>

update or insert the given column, return the old value

Source

pub fn remove<T: Data>(&mut self) -> Option<T>

remove a column of type T from this row

Source

pub fn extend<V: RowLike>(&mut self, value: V) -> Row

Extends this row and replace existing columns

returns the replaces columns

Source

pub fn extend_row(&mut self, row: Row) -> Row

Extends this row and replace existing columns

returns the replaces columns

Source

pub fn match_grid(&self, grid: &Grid, partial: bool) -> bool

returns true if the this grid contains these columns

if partial is true, this grid should contains at least these columns.

if partial is false this grid should contain exactly these columns

For tuples of Data, match grid panics if the same type is present more than once

Trait Implementations§

Source§

impl Debug for Row

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Row

Source§

fn default() -> Row

Returns the “default value” for a type. Read more
Source§

impl From<Row> for Grid

Source§

fn from(value: Row) -> Self

Converts to this type from the input type.
Source§

impl From<Vec<Box<dyn Cell>>> for Row

Source§

fn from(value: Vec<Box<dyn Cell>>) -> Self

Converts to this type from the input type.
Source§

impl FromIterator<Box<dyn Cell>> for Row

Source§

fn from_iter<T: IntoIterator<Item = Box<dyn Cell>>>(iter: T) -> Self

Creates a value from an iterator. Read more
Source§

impl<'a> IntoIterator for &'a Row

Source§

type IntoIter = <&'a AHashMap<TypeId, Box<dyn Cell>> as IntoIterator>::IntoIter

Which kind of iterator are we turning this into?
Source§

type Item = <&'a AHashMap<TypeId, Box<dyn Cell>> as IntoIterator>::Item

The type of the elements being iterated over.
Source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
Source§

impl<'a> IntoIterator for &'a mut Row

Source§

type IntoIter = <&'a mut AHashMap<TypeId, Box<dyn Cell>> as IntoIterator>::IntoIter

Which kind of iterator are we turning this into?
Source§

type Item = <&'a mut AHashMap<TypeId, Box<dyn Cell>> as IntoIterator>::Item

The type of the elements being iterated over.
Source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
Source§

impl IntoIterator for Row

Source§

type IntoIter = <AHashMap<TypeId, Box<dyn Cell>> as IntoIterator>::IntoIter

Which kind of iterator are we turning this into?
Source§

type Item = <AHashMap<TypeId, Box<dyn Cell>> as IntoIterator>::Item

The type of the elements being iterated over.
Source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more

Auto Trait Implementations§

§

impl Freeze for Row

§

impl !RefUnwindSafe for Row

§

impl Send for Row

§

impl Sync for Row

§

impl Unpin for Row

§

impl !UnwindSafe for Row

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> Cell for T
where T: Data,

Source§

fn cell_type_id(&self) -> TypeId

type id of this Cell Read more
Source§

fn into_any_box(self: Box<T>) -> Box<dyn Any>

wraps the inner element in a box
Source§

fn into_cell(self) -> Box<dyn Cell>

create a new cell from with item
Source§

fn into_column(self: Box<T>) -> Box<dyn Column>

create a new column with this item
Source§

impl<T> Data for T
where T: Any + Send + Sync + Debug,

Source§

const ID: TypeId = const ID: TypeId = TypeId::of::<T>();

Const type id of this datatype
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> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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 more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

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

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.