pub trait Layout:
'static
+ Send
+ Sync
+ Debug
+ Sealed {
// Required methods
fn as_any(&self) -> &dyn Any;
fn as_any_arc(self: Arc<Self>) -> Arc<dyn Any + Send + Sync> ⓘ;
fn to_layout(&self) -> LayoutRef;
fn encoding(&self) -> LayoutEncodingRef;
fn row_count(&self) -> u64;
fn dtype(&self) -> &DType;
fn nchildren(&self) -> usize;
fn child(&self, idx: usize) -> VortexResult<LayoutRef>;
fn child_type(&self, idx: usize) -> LayoutChildType;
fn metadata(&self) -> Vec<u8> ⓘ;
fn segment_ids(&self) -> Vec<SegmentId>;
fn new_reader(
&self,
name: Arc<str>,
segment_source: Arc<dyn SegmentSource>,
session: &VortexSession,
ctx: &LayoutReaderContext,
) -> VortexResult<LayoutReaderRef>;
}Expand description
Erased layout tree node.
A layout is immutable metadata describing how row data is organized into child layouts and physical byte segments. It is self-describing only when paired with the session registries used to deserialize its encoding ids and the segment source used to read bytes.
Required Methods§
Sourcefn as_any(&self) -> &dyn Any
fn as_any(&self) -> &dyn Any
Returns this layout as Any for downcasting through the dyn Layout helpers.
Sourcefn as_any_arc(self: Arc<Self>) -> Arc<dyn Any + Send + Sync> ⓘ
fn as_any_arc(self: Arc<Self>) -> Arc<dyn Any + Send + Sync> ⓘ
Converts an owned layout reference into erased Any for Arc downcasting.
Sourcefn encoding(&self) -> LayoutEncodingRef
fn encoding(&self) -> LayoutEncodingRef
Returns the crate::LayoutEncoding for this layout.
Sourcefn child(&self, idx: usize) -> VortexResult<LayoutRef>
fn child(&self, idx: usize) -> VortexResult<LayoutRef>
Get the child at the given index.
Child ordering and meaning are encoding-specific and described by
child_type.
Sourcefn child_type(&self, idx: usize) -> LayoutChildType
fn child_type(&self, idx: usize) -> LayoutChildType
Get the relative row offset of the child at the given index, returning None for
any auxiliary children, e.g. dictionary values, zone maps, etc.
Sourcefn segment_ids(&self) -> Vec<SegmentId>
fn segment_ids(&self) -> Vec<SegmentId>
Get the segment IDs directly referenced by this layout node.
Sourcefn new_reader(
&self,
name: Arc<str>,
segment_source: Arc<dyn SegmentSource>,
session: &VortexSession,
ctx: &LayoutReaderContext,
) -> VortexResult<LayoutReaderRef>
fn new_reader( &self, name: Arc<str>, segment_source: Arc<dyn SegmentSource>, session: &VortexSession, ctx: &LayoutReaderContext, ) -> VortexResult<LayoutReaderRef>
Construct a new reader for this layout.
name— human-readable label for this reader, propagated to child readers (typically by appending a path component) and surfaced in tracing/debug output.segment_source— source of segment bytes for this and any descendant readers constructed from the returned reader; recursive callers should pass the same source through.session— theVortexSessionhosting the encoding/scalar/layout registries and execution context the reader needs at evaluation time.ctx— id-keyed dependency registry threaded through reader construction (seeLayoutReaderContext). Top-level callers (file open, tests) typically pass&LayoutReaderContext::new(); recursive callers inside layout implementations must propagate thectxthey were handed so ancestor-published values reach descendants.
Implementations§
Source§impl dyn Layout + '_
impl dyn Layout + '_
Sourcepub fn flatbuffer_writer<'a>(
&'a self,
ctx: &'a LayoutContext,
) -> impl WriteFlatBuffer<Target<'a> = Layout<'a>> + FlatBufferRoot + 'a
pub fn flatbuffer_writer<'a>( &'a self, ctx: &'a LayoutContext, ) -> impl WriteFlatBuffer<Target<'a> = Layout<'a>> + FlatBufferRoot + 'a
Serialize the layout into a FlatBufferBuilder.
Source§impl dyn Layout + '_
impl dyn Layout + '_
Sourcepub fn encoding_id(&self) -> LayoutEncodingId
pub fn encoding_id(&self) -> LayoutEncodingId
The ID of the encoding for this layout.
Sourcepub fn children(&self) -> VortexResult<Vec<LayoutRef>>
pub fn children(&self) -> VortexResult<Vec<LayoutRef>>
The children of this layout.
Sourcepub fn child_types(&self) -> impl Iterator<Item = LayoutChildType>
pub fn child_types(&self) -> impl Iterator<Item = LayoutChildType>
The child types of this layout.
Sourcepub fn child_names(&self) -> impl Iterator<Item = Arc<str>>
pub fn child_names(&self) -> impl Iterator<Item = Arc<str>>
The names of the children of this layout.
Sourcepub fn child_row_offsets(&self) -> impl Iterator<Item = Option<u64>>
pub fn child_row_offsets(&self) -> impl Iterator<Item = Option<u64>>
The row offsets of the children of this layout, where None indicates an auxiliary child.
pub fn is<V: VTable>(&self) -> bool
Sourcepub fn into<V: VTable>(self: Arc<Self>) -> Arc<V::Layout> ⓘ
pub fn into<V: VTable>(self: Arc<Self>) -> Arc<V::Layout> ⓘ
Downcast a layout to a specific type.
Sourcepub fn depth_first_traversal(
&self,
) -> impl Iterator<Item = VortexResult<LayoutRef>>
pub fn depth_first_traversal( &self, ) -> impl Iterator<Item = VortexResult<LayoutRef>>
Depth-first traversal of the layout and its children.
Sourcepub fn display_tree(&self) -> DisplayLayoutTree
pub fn display_tree(&self) -> DisplayLayoutTree
Display the layout as a tree structure.
Sourcepub fn display_tree_verbose(&self, verbose: bool) -> DisplayLayoutTree
pub fn display_tree_verbose(&self, verbose: bool) -> DisplayLayoutTree
Display the layout as a tree structure with optional verbose metadata.
Sourcepub async fn display_tree_with_segments(
&self,
segment_source: Arc<dyn SegmentSource>,
) -> VortexResult<DisplayLayoutTree>
pub async fn display_tree_with_segments( &self, segment_source: Arc<dyn SegmentSource>, ) -> VortexResult<DisplayLayoutTree>
Display the layout as a tree structure, fetching segment buffer sizes from the segment source.
§Warning
This function performs IO to fetch each segment’s buffer. For layouts with many segments, this may result in significant IO overhead.
Trait Implementations§
Source§impl AsRef<dyn Layout> for ChunkedLayout
impl AsRef<dyn Layout> for ChunkedLayout
Source§impl AsRef<dyn Layout> for DictLayout
impl AsRef<dyn Layout> for DictLayout
Source§impl AsRef<dyn Layout> for FlatLayout
impl AsRef<dyn Layout> for FlatLayout
Source§impl AsRef<dyn Layout> for StructLayout
impl AsRef<dyn Layout> for StructLayout
Source§impl AsRef<dyn Layout> for ZonedLayout
impl AsRef<dyn Layout> for ZonedLayout
Source§impl AsRef<dyn Layout> for LegacyStatsLayout
impl AsRef<dyn Layout> for LegacyStatsLayout
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".