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§
Sourcefn content_type(&self) -> ContentTypeId
fn content_type(&self) -> ContentTypeId
Returns the content type ID this plugin handles
Sourcefn schema(&self) -> ContentSchema
fn schema(&self) -> ContentSchema
Returns the schema for this content type
Sourcefn parse(&self, data: &[u8]) -> Result<Box<dyn ServeableContent>>
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.
Sourcefn serialize(&self, content: &dyn ServeableContent) -> Result<Vec<u8>>
fn serialize(&self, content: &dyn ServeableContent) -> Result<Vec<u8>>
Serializes ServeableContent back to bytes
§Errors
Returns an error if the content cannot be serialized.
Sourcefn render_hints(&self) -> RenderHints
fn render_hints(&self) -> RenderHints
Returns UI rendering hints for trueno-viz integration
Sourcefn description(&self) -> &str
fn description(&self) -> &str
Plugin description