Skip to main content

MemorySource

Struct MemorySource 

Source
pub struct MemorySource { /* private fields */ }
Expand description

A table’s rows in memory.

Implementations§

Source§

impl MemorySource

Source

pub fn new(table: Table) -> Rc<Self>

Source

pub fn data(&self) -> Rc<Vec<Row>>

The rows, in primary key order.

Source

pub fn fork(&self) -> Rc<Self>

A source with the same rows that shares them until either is written (fork). It has no connections and only the primary index.

Source

pub fn has_connections(&self) -> bool

Whether a pipeline reads the source.

Source

pub fn contains(&self, row: &Row) -> bool

Whether the source has a row with row’s primary key.

Source

pub fn same_key(&self, a: &Row, b: &Row) -> bool

Whether a and b have the same primary key.

Source

pub fn index_keys(&self) -> Vec<String>

For tests: the keys of the indexes built so far.

Source

pub fn push_adds(&self, rows: Vec<Row>)

Pushes an add for each of rows. When nothing is connected and the source is empty, builds the primary index in one pass instead.

Trait Implementations§

Source§

impl Source for MemorySource

Source§

fn table_schema(&self) -> &Table

Source§

fn connect( &self, sort: Option<Vec<OrderPart>>, filters: Option<&Condition>, split_edit_keys: Option<&HashSet<String>>, ) -> Result<Rc<dyn SourceInput>, PipelineError>

Connects a pipeline. sort is None for an unordered connection.
Source§

fn push(&self, change: SourceChange)

Auto Trait Implementations§

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.