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>
impl<'b> TableW<'b>
pub fn set<T: Le>(&mut self, off: u16, presence: Bit, v: T)
pub fn set_bool(&mut self, presence: Bit, v: bool)
pub fn set_bytes(&mut self, off: u16, b: &[u8])
pub fn set_str(&mut self, off: u16, s: &str)
pub fn set_scalars<T: Le>(&mut self, off: u16, v: &[T])
Sourcepub fn set_strs<'s>(
&mut self,
off: u16,
v: impl ExactSizeIterator<Item = &'s str>,
)
pub fn set_strs<'s>( &mut self, off: u16, v: impl ExactSizeIterator<Item = &'s str>, )
[string]: same layout as set_bytes_list.
Sourcepub fn set_bytes_list<'s>(
&mut self,
off: u16,
v: impl ExactSizeIterator<Item = &'s [u8]>,
)
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.
Sourcepub fn union(&mut self, off: u16, tag: u16, fixed_len: u16) -> TableW<'_>
pub fn union(&mut self, off: u16, tag: u16, fixed_len: u16) -> TableW<'_>
Union slot [u16 tag][i32 ptr] with a nested table variant.
Sourcepub fn table_fixed<const N: usize>(&mut self, off: u16) -> FixedW<'_, N>
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.
Sourcepub fn union_fixed<const N: usize>(
&mut self,
off: u16,
tag: u16,
) -> FixedW<'_, N>
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)).
Sourcepub fn tables(
&mut self,
off: u16,
n: u32,
elem_fixed_len: u16,
) -> TableListW<'_>
pub fn tables( &mut self, off: u16, n: u32, elem_fixed_len: u16, ) -> TableListW<'_>
List of n tables, fixed parts reserved contiguously in main.
Sourcepub fn tables_fixed<const N: usize>(
&mut self,
off: u16,
n: u32,
) -> FixedListW<'_, N>
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.
Sourcepub fn tables_streaming(
&mut self,
off: u16,
elem_fixed_len: u16,
ptr_slots: &'static [u16],
) -> StreamListW<'_, 'b>
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).
Sourcepub fn scalars_streaming<T: Le>(&mut self, off: u16) -> ScalarListW<'_, T>
pub fn scalars_streaming<T: Le>(&mut self, off: u16) -> ScalarListW<'_, T>
Scalar list of unknown length appended directly to main.