Skip to main content

ServeableContent

Trait ServeableContent 

Source
pub trait ServeableContent: Send + Sync {
    // Required methods
    fn schema(&self) -> ContentSchema;
    fn validate(&self) -> Result<ValidationReport>;
    fn to_arrow(&self) -> Result<RecordBatch>;
    fn metadata(&self) -> ContentMetadata;
    fn content_type(&self) -> ContentTypeId;
    fn chunks(
        &self,
        chunk_size: usize,
    ) -> Box<dyn Iterator<Item = Result<RecordBatch>> + Send>;
    fn to_bytes(&self) -> Result<Vec<u8>>;
}
Expand description

Trait for any content that can be served via WASM

This trait provides the abstraction layer between content types (datasets, courses, models, raw data) and the serving infrastructure.

Required Methods§

Source

fn schema(&self) -> ContentSchema

Returns the content schema for validation and UI generation

Source

fn validate(&self) -> Result<ValidationReport>

Validates content integrity

§Errors

Returns an error if validation cannot be performed.

Source

fn to_arrow(&self) -> Result<RecordBatch>

Converts content to Arrow RecordBatch for efficient transfer

§Errors

Returns an error if the content cannot be converted to Arrow format.

Source

fn metadata(&self) -> ContentMetadata

Returns content metadata for indexing and discovery

Source

fn content_type(&self) -> ContentTypeId

Returns content type identifier

Source

fn chunks( &self, chunk_size: usize, ) -> Box<dyn Iterator<Item = Result<RecordBatch>> + Send>

Chunk iterator for streaming large content

Source

fn to_bytes(&self) -> Result<Vec<u8>>

Get the raw bytes representation (for serialization)

§Errors

Returns an error if the content cannot be serialized to bytes.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§