Skip to main content

Runnable

Trait Runnable 

Source
pub trait Runnable:
    Any
    + Downcast
    + Debug
    + Send
    + Sync
    + 'static {
    // Required methods
    fn spawn(&self) -> Result<Box<dyn State>, Error>;
    fn typed_plan(
        &self,
    ) -> Option<&Arc<SimplePlan<TypedFact, Box<dyn TypedOp>>>>;
    fn typed_model(&self) -> Option<&Arc<Graph<TypedFact, Box<dyn TypedOp>>>>;

    // Provided methods
    fn run(
        &self,
        inputs: SmallVec<[TValue; 4]>,
    ) -> Result<SmallVec<[TValue; 4]>, Error> { ... }
    fn input_count(&self) -> usize { ... }
    fn output_count(&self) -> usize { ... }
    fn input_fact(&self, ix: usize) -> Result<&TypedFact, Error> { ... }
    fn output_fact(&self, ix: usize) -> Result<&TypedFact, Error> { ... }
    fn properties(&self) -> &HashMap<String, Arc<Tensor>> { ... }
}

Required Methods§

Provided Methods§

Implementations§

Source§

impl dyn Runnable

Source

pub fn is<__T>(&self) -> bool
where __T: Runnable,

Returns true if the trait object wraps an object of type __T.

Source

pub fn downcast<__T>( self: Box<dyn Runnable>, ) -> Result<Box<__T>, Box<dyn Runnable>>
where __T: Runnable,

Returns a boxed object from a boxed trait object if the underlying object is of type __T. Returns the original boxed trait if it isn’t.

Source

pub fn downcast_rc<__T>( self: Rc<dyn Runnable>, ) -> Result<Rc<__T>, Rc<dyn Runnable>>
where __T: Runnable,

Returns an Rc-ed object from an Rc-ed trait object if the underlying object is of type __T. Returns the original Rc-ed trait if it isn’t.

Source

pub fn downcast_ref<__T>(&self) -> Option<&__T>
where __T: Runnable,

Returns a reference to the object within the trait object if it is of type __T, or None if it isn’t.

Source

pub fn downcast_mut<__T>(&mut self) -> Option<&mut __T>
where __T: Runnable,

Returns a mutable reference to the object within the trait object if it is of type __T, or None if it isn’t.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§