Trait Framework

Source
pub trait Framework<ProtoModel, Model>: Send + Sync
where ProtoModel: Debug, Model: Default,
{ // Required methods fn proto_model_for_read( &self, reader: &mut dyn Read, ) -> Result<ProtoModel, Error>; fn model_for_proto_model_with_model_template( &self, proto: &ProtoModel, template: Model, ) -> Result<Model, Error>; // Provided methods fn model_for_proto_model(&self, proto: &ProtoModel) -> Result<Model, Error> { ... } fn proto_model_for_path( &self, p: impl AsRef<Path>, ) -> Result<ProtoModel, Error> { ... } fn model_for_read(&self, r: &mut dyn Read) -> Result<Model, Error> { ... } fn model_for_path(&self, p: impl AsRef<Path>) -> Result<Model, Error> { ... } }
Expand description

A Framework that translate its model to tract core model.

The ProtoModel is the parsed representation of the imported model. It does not have to be Protobuf based.

Required Methods§

Source

fn proto_model_for_read( &self, reader: &mut dyn Read, ) -> Result<ProtoModel, Error>

Parse a proto model from a reader.

Source

fn model_for_proto_model_with_model_template( &self, proto: &ProtoModel, template: Model, ) -> Result<Model, Error>

Translate a proto model into a model, with some symbols already listed.

Provided Methods§

Source

fn model_for_proto_model(&self, proto: &ProtoModel) -> Result<Model, Error>

Translate a proto model into a model.

Source

fn proto_model_for_path(&self, p: impl AsRef<Path>) -> Result<ProtoModel, Error>

Read a proto model from a filename.

Source

fn model_for_read(&self, r: &mut dyn Read) -> Result<Model, Error>

Read a model from a reader

Source

fn model_for_path(&self, p: impl AsRef<Path>) -> Result<Model, Error>

Build a model from a filename.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§