Skip to main content

Assembly

Struct Assembly 

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

A vector being built out of pieces, each landing at the positions it is given.

Build one with Assembly::new, call Assembly::place once per piece, and finish it with Assembly::finish. A row no piece claims is null.

Implementations§

Source§

impl Assembly

Source

pub fn new(ty: LogicalType, rows: usize) -> Result<Self>

An assembly of rows rows of ty, with every row null until a piece claims it.

§Errors

If the type is one there is no flat layout for yet, which today means ARRAY and UNION.

Source

pub fn rows(&self) -> usize

How many rows the finished vector will have.

Source

pub fn place(&mut self, positions: &[u32], piece: &Vector) -> Result<()>

Writes row n of piece at output row positions[n], for every row of piece.

A row claimed twice takes the value the later call gave it, which is not a case CASE produces, since its arms run over disjoint sets of rows, and is defined rather than left open so that a caller that does it gets an answer instead of whichever of the two the copy loop happened to reach.

§Errors

If piece has a different number of rows than there are positions, if a position is past the end of the assembly, or if piece is not of a layout that can be laid after what is already there.

Source

pub fn finish(self) -> Result<Vector>

The finished vector.

§Errors

If the run of data that came out of the pieces is not one the type can hold.

Trait Implementations§

Source§

impl Debug for Assembly

Source§

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

Formats the value using the given formatter. 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> 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, 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.