Skip to main content

RunnableInterface

Trait RunnableInterface 

Source
pub trait RunnableInterface:
    Debug
    + Send
    + Sync {
    type Tensor: TensorInterface;
    type Fact: FactInterface;
    type State: StateInterface<Tensor = Self::Tensor>;

    // Required methods
    fn input_count(&self) -> Result<usize>;
    fn output_count(&self) -> Result<usize>;
    fn input_fact(&self, id: usize) -> Result<Self::Fact>;
    fn output_fact(&self, id: usize) -> Result<Self::Fact>;
    fn property_keys(&self) -> Result<Vec<String>>;
    fn property(&self, name: impl AsRef<str>) -> Result<Self::Tensor>;
    fn spawn_state(&self) -> Result<Self::State>;
    fn cost_json(&self) -> Result<String>;
    fn profile_json<I, IV, IE>(&self, inputs: Option<I>) -> Result<String>
       where I: IntoIterator<Item = IV>,
             IV: TryInto<Self::Tensor, Error = IE>,
             IE: Into<Error> + Debug;

    // Provided methods
    fn run(
        &self,
        inputs: impl IntoInputs<Self::Tensor>,
    ) -> Result<Vec<Self::Tensor>> { ... }
    fn input_facts(&self) -> Result<impl Iterator<Item = Self::Fact>> { ... }
    fn output_facts(&self) -> Result<impl Iterator<Item = Self::Fact>> { ... }
}

Required Associated Types§

Required Methods§

Source

fn input_count(&self) -> Result<usize>

Source

fn output_count(&self) -> Result<usize>

Source

fn input_fact(&self, id: usize) -> Result<Self::Fact>

Source

fn output_fact(&self, id: usize) -> Result<Self::Fact>

Source

fn property_keys(&self) -> Result<Vec<String>>

Source

fn property(&self, name: impl AsRef<str>) -> Result<Self::Tensor>

Source

fn spawn_state(&self) -> Result<Self::State>

Source

fn cost_json(&self) -> Result<String>

Source

fn profile_json<I, IV, IE>(&self, inputs: Option<I>) -> Result<String>
where I: IntoIterator<Item = IV>, IV: TryInto<Self::Tensor, Error = IE>, IE: Into<Error> + Debug,

Provided Methods§

Source

fn run( &self, inputs: impl IntoInputs<Self::Tensor>, ) -> Result<Vec<Self::Tensor>>

Source

fn input_facts(&self) -> Result<impl Iterator<Item = Self::Fact>>

Source

fn output_facts(&self) -> Result<impl Iterator<Item = Self::Fact>>

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§