Skip to main content

ContentPlugin

Trait ContentPlugin 

Source
pub trait ContentPlugin: Send + Sync {
    // Required methods
    fn content_type(&self) -> ContentTypeId;
    fn schema(&self) -> ContentSchema;
    fn parse(&self, data: &[u8]) -> Result<Box<dyn ServeableContent>>;
    fn serialize(&self, content: &dyn ServeableContent) -> Result<Vec<u8>>;
    fn render_hints(&self) -> RenderHints;
    fn version(&self) -> &str;
    fn name(&self) -> &str;
    fn description(&self) -> &str;
}
Expand description

Plugin interface for extending alimentar with new content types

Implement this trait to add support for custom content types that can be served, validated, and visualized.

Required Methods§

Source

fn content_type(&self) -> ContentTypeId

Returns the content type ID this plugin handles

Source

fn schema(&self) -> ContentSchema

Returns the schema for this content type

Source

fn parse(&self, data: &[u8]) -> Result<Box<dyn ServeableContent>>

Parses raw content into ServeableContent

§Errors

Returns an error if the data cannot be parsed into the expected content type.

Source

fn serialize(&self, content: &dyn ServeableContent) -> Result<Vec<u8>>

Serializes ServeableContent back to bytes

§Errors

Returns an error if the content cannot be serialized.

Source

fn render_hints(&self) -> RenderHints

Returns UI rendering hints for trueno-viz integration

Source

fn version(&self) -> &str

Plugin version for compatibility

Source

fn name(&self) -> &str

Plugin name for display

Source

fn description(&self) -> &str

Plugin description

Implementors§