Skip to main content

HasRawView

Trait HasRawView 

Source
pub trait HasRawView<'a> {
    // Required methods
    fn raw_view(&self) -> &RawView<'a>;
    fn block_end_dyn(&self) -> usize;
}
Expand description

Implemented by every generated XxxView<'a> type.

This trait exists so that merge_table_list can access the vtable position and block boundaries of a table element view without knowing its concrete type at compile time. Without this trait the generic function would require a type parameter for each table type, causing a separate monomorphization per list field per table — exactly the compile-time cost we are trying to avoid.

Both methods are #[inline(always)] in the generated impls so the indirection has no runtime cost.

Required Methods§

Source

fn raw_view(&self) -> &RawView<'a>

Return a reference to the inner RawView for this view.

Source

fn block_end_dyn(&self) -> usize

Return the exclusive end byte position of this table’s data block in the source buffer. Equivalent to the generated block_end() method.

Used by merge_table_list to determine the size of the block to copy when merging: block_size = block_end() - t_pos.

Implementors§