Skip to main content

RowBatch

Struct RowBatch 

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

Registros montados fora da interface (numa thread), para entrar num ClientDataSet de uma vez com DataSet::load_batch: milhões de linhas sem passar valor por valor pela tela nem refazer a ordem a cada pacote.

Cada linha é escrita célula a célula, na ordem dos campos de dados, e termina com end_row. Os valores entram já no tipo do campo (não há conversão: um texto num campo inteiro vira uma coluna de valores misturados). Lotes montados em paralelo se juntam com append.

use aylis_data::RowBatch;
let mut lote = RowBatch::new(2);
for i in 0..3 {
    lote.int(i).text("São Paulo").end_row();
}
assert_eq!(lote.len(), 3);

Implementations§

Source§

impl RowBatch

Source

pub const PART: usize = CHUNK

Lotes montados em paralelo com um múltiplo deste número de registros (menos o último) se juntam sem copiar: os blocos de memória passam de um para o outro.

Source

pub fn new(width: usize) -> Self

Um lote vazio com width colunas (os campos de dados, na ordem).

Source

pub fn len(&self) -> usize

Quantos registros completos.

Source

pub fn is_empty(&self) -> bool

Source

pub fn width(&self) -> usize

Source

pub fn int(&mut self, v: i64) -> &mut Self

Um inteiro: direto na coluna (sem passar por Value) quando ela já é de inteiros.

Source

pub fn float(&mut self, v: f64) -> &mut Self

Um número: direto na coluna quando ela já é de números.

Source

pub fn bool(&mut self, v: bool) -> &mut Self

Source

pub fn text(&mut self, s: &str) -> &mut Self

Um texto: se ele já está no dicionário da coluna, não copia nada.

Source

pub fn value(&mut self, v: Value) -> &mut Self

Qualquer valor (data, decimal…).

Source

pub fn null(&mut self) -> &mut Self

Source

pub fn end_row(&mut self)

Fecha a linha (as células que faltaram ficam nulas).

Source

pub fn push(&mut self, values: Vec<Value>)

Uma linha inteira de uma vez.

Source

pub fn append(&mut self, other: RowBatch)

Junta os registros de outro lote (das mesmas colunas) no fim deste.

Trait Implementations§

Source§

impl Clone for RowBatch

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for RowBatch

Source§

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

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

impl Default for RowBatch

Source§

fn default() -> Self

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

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.