TableW

Struct TableW 

Source
pub struct TableW<'b> { /* private fields */ }
Expand description

Writer for one table. The fixed part lives in aux when it is a streaming list element, otherwise in main; variable data always goes to main.

§Panics

Writer panics are programmer errors, never a consequence of data read from outside: pushing more than the n elements reserved for a list, reserving a list larger than i32::MAX bytes (2 GiB), or using a Builder after finish.

Implementations§

Source§

impl<'b> TableW<'b>

Source

pub fn set<T: Le>(&mut self, off: u16, presence: Bit, v: T)

Source

pub fn set_bool(&mut self, presence: Bit, v: bool)

Source

pub fn set_bytes(&mut self, off: u16, b: &[u8])

Source

pub fn set_str(&mut self, off: u16, s: &str)

Source

pub fn set_scalars<T: Le>(&mut self, off: u16, v: &[T])

Source

pub fn set_strs<'s>( &mut self, off: u16, v: impl ExactSizeIterator<Item = &'s str>, )

[string]: same layout as set_bytes_list.

Source

pub fn set_bytes_list<'s>( &mut self, off: u16, v: impl ExactSizeIterator<Item = &'s [u8]>, )

[bytes]: [u32 count][count × i32 offset], then each [u32 len][bytes] in order.

Source

pub fn table(&mut self, off: u16, fixed_len: u16) -> TableW<'_>

Nested table appended to main.

Source

pub fn union(&mut self, off: u16, tag: u16, fixed_len: u16) -> TableW<'_>

Union slot [u16 tag][i32 ptr] with a nested table variant.

Source

pub fn table_fixed<const N: usize>(&mut self, off: u16) -> FixedW<'_, N>

Nested all-scalar table of compile-time size N (same bytes as table(off, N)), written through a FixedW.

Source

pub fn union_fixed<const N: usize>( &mut self, off: u16, tag: u16, ) -> FixedW<'_, N>

Union slot with an all-scalar variant of compile-time size N (same bytes as union(off, tag, N)).

Source

pub fn tables( &mut self, off: u16, n: u32, elem_fixed_len: u16, ) -> TableListW<'_>

List of n tables, fixed parts reserved contiguously in main.

Source

pub fn tables_fixed<const N: usize>( &mut self, off: u16, n: u32, ) -> FixedListW<'_, N>

List of n all-scalar tables of compile-time size N. The element region is split into [u8; N] chunks once, so push is an iterator step with no per-element slicing or bounds checks.

Source

pub fn tables_streaming( &mut self, off: u16, elem_fixed_len: u16, ptr_slots: &'static [u16], ) -> StreamListW<'_, 'b>

List of tables of unknown length. Element fixed parts are built in a pooled aux buffer and copied on close; ptr_slots lists every i32 pointer offset inside an element’s fixed part (fixed up on close).

Source

pub fn scalars_streaming<T: Le>(&mut self, off: u16) -> ScalarListW<'_, T>

Scalar list of unknown length appended directly to main.

Auto Trait Implementations§

§

impl<'b> Freeze for TableW<'b>

§

impl<'b> !RefUnwindSafe for TableW<'b>

§

impl<'b> !Send for TableW<'b>

§

impl<'b> !Sync for TableW<'b>

§

impl<'b> Unpin for TableW<'b>

§

impl<'b> !UnwindSafe for TableW<'b>

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 = 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.