Trait tract_pulse::internal::Framework[]

pub trait Framework<ProtoModel, Model> where
    ProtoModel: Debug
{ fn proto_model_for_read(
        &self,
        reader: &mut dyn Read
    ) -> Result<ProtoModel, Error>;
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

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

Expand description

Parse a proto model from a reader.

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

Expand description

Translate a proto model into a model.

Provided methods

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

Expand description

Read a proto model from a filename.

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

Expand description

Read a model from a reader

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

Expand description

Build a model from a filename.

Implementors

impl Framework<ProtoModel, Graph<TypedFact, Box<dyn TypedOp + 'static, Global>>> for Nnef

pub fn model_for_path(
    &self,
    p: impl AsRef<Path>
) -> Result<Graph<TypedFact, Box<dyn TypedOp + 'static, Global>>, Error>

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

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

pub fn model_for_proto_model(
    &self,
    proto: &ProtoModel
) -> Result<Graph<TypedFact, Box<dyn TypedOp + 'static, Global>>, Error>