pub trait VTable:
'static
+ Clone
+ Send
+ Sync
+ Debug {
type LayoutData: 'static + Clone + Send + Sync + Debug;
type Metadata: SerializeMetadata + DeserializeMetadata + Debug;
// Required methods
fn id(&self) -> LayoutId;
fn metadata(layout: &Layout<Self>) -> Self::Metadata;
fn deserialize(
&self,
args: &LayoutDeserializeArgs<'_>,
metadata: &<Self::Metadata as DeserializeMetadata>::Output,
) -> VortexResult<Self::LayoutData>;
fn child_dtype(layout: &Layout<Self>, slot: usize) -> VortexResult<DType>;
fn child_type(layout: &Layout<Self>, slot: usize) -> LayoutChildType;
fn new_reader(
layout: &Layout<Self>,
name: Arc<str>,
segment_source: Arc<dyn SegmentSource>,
session: &VortexSession,
ctx: &LayoutReaderContext,
) -> VortexResult<LayoutReaderRef>;
// Provided methods
fn build(
vtable: &Self,
dtype: &DType,
row_count: u64,
metadata: &<Self::Metadata as DeserializeMetadata>::Output,
segment_ids: Vec<SegmentId>,
children: &dyn LayoutChildren,
build_ctx: &LayoutBuildContext<'_>,
) -> VortexResult<Layout<Self>> { ... }
fn nslots(layout: &Layout<Self>) -> usize { ... }
fn slot_to_child(layout: &Layout<Self>, slot: usize) -> Option<usize> { ... }
fn is_indivisible(&self) -> bool { ... }
}Expand description
Required Associated Types§
Sourcetype Metadata: SerializeMetadata + DeserializeMetadata + Debug
type Metadata: SerializeMetadata + DeserializeMetadata + Debug
Serialized metadata type.
Required Methods§
Sourcefn metadata(layout: &Layout<Self>) -> Self::Metadata
fn metadata(layout: &Layout<Self>) -> Self::Metadata
Returns the serializable metadata for a layout.
Sourcefn deserialize(
&self,
args: &LayoutDeserializeArgs<'_>,
metadata: &<Self::Metadata as DeserializeMetadata>::Output,
) -> VortexResult<Self::LayoutData>
fn deserialize( &self, args: &LayoutDeserializeArgs<'_>, metadata: &<Self::Metadata as DeserializeMetadata>::Output, ) -> VortexResult<Self::LayoutData>
Deserialize and validate layout-specific data.
Sourcefn child_dtype(layout: &Layout<Self>, slot: usize) -> VortexResult<DType>
fn child_dtype(layout: &Layout<Self>, slot: usize) -> VortexResult<DType>
Returns the expected dtype of the child in logical slot.
Sourcefn child_type(layout: &Layout<Self>, slot: usize) -> LayoutChildType
fn child_type(layout: &Layout<Self>, slot: usize) -> LayoutChildType
Returns the relationship between the child in logical slot and its parent.
Sourcefn new_reader(
layout: &Layout<Self>,
name: Arc<str>,
segment_source: Arc<dyn SegmentSource>,
session: &VortexSession,
ctx: &LayoutReaderContext,
) -> VortexResult<LayoutReaderRef>
fn new_reader( layout: &Layout<Self>, name: Arc<str>, segment_source: Arc<dyn SegmentSource>, session: &VortexSession, ctx: &LayoutReaderContext, ) -> VortexResult<LayoutReaderRef>
Construct a reader for this layout.
Provided Methods§
Sourcefn build(
vtable: &Self,
dtype: &DType,
row_count: u64,
metadata: &<Self::Metadata as DeserializeMetadata>::Output,
segment_ids: Vec<SegmentId>,
children: &dyn LayoutChildren,
build_ctx: &LayoutBuildContext<'_>,
) -> VortexResult<Layout<Self>>
fn build( vtable: &Self, dtype: &DType, row_count: u64, metadata: &<Self::Metadata as DeserializeMetadata>::Output, segment_ids: Vec<SegmentId>, children: &dyn LayoutChildren, build_ctx: &LayoutBuildContext<'_>, ) -> VortexResult<Layout<Self>>
Construct a typed layout from deserialized common fields.
Sourcefn nslots(layout: &Layout<Self>) -> usize
fn nslots(layout: &Layout<Self>) -> usize
Returns the number of logical child slots of this layout.
Slots are fixed logical positions: a given child always occupies the same slot index
regardless of which optional siblings are present. A slot may be absent (see
slot_to_child), in which case it has no corresponding serialized
child. The default implementation reports one slot per serialized child, i.e. every slot is
always present.
Sourcefn slot_to_child(layout: &Layout<Self>, slot: usize) -> Option<usize>
fn slot_to_child(layout: &Layout<Self>, slot: usize) -> Option<usize>
Maps a logical slot to the index of its serialized (dense) child, or None if the slot
is absent for this layout instance.
Serialized children are stored densely (present-only), so an absent slot shifts the dense indices of the slots that follow it. This mapping centralizes that arithmetic; the default implementation is the identity, treating slot indices and dense child indices as equal.
Sourcefn is_indivisible(&self) -> bool
fn is_indivisible(&self) -> bool
Returns true if this layout is indivisible: its readers never register natural split
boundaries strictly inside their row range (see crate::LayoutReader::register_splits).
Indivisible layouts — like flat, whose readers only ever push the end of the requested range — let parent layouts skip materializing the child entirely during split collection.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".