Skip to main content

Runs

Trait Runs 

Source
pub trait Runs<M>: Sized {
    type In;
    type Out: 'static;
    type Error;

    const SYNC: bool;

    // Required method
    fn drive(
        self,
        ctx: Context,
        upstreams: Upstreams<Self::In>,
        downstream: Downstream<Self::Out>,
    ) -> Result<Fin, Self::Error>;
}
Available on crate feature runtime only.
Expand description

THE AUTONOMOUS ROW of the face table: what one node’s whole life IS, at each of the two faces.

Driven’s shape at a third seam, and it exists for that trait’s own reason: the two faces carry the same three associated types under different trait names, and every door that spends them would otherwise be written twice. Block selects AutonomousOperator and Async selects AsyncAutonomousOperator, so a bound written over this row serves both.

§THE TWO ROWS COLLAPSE INTO ONE DRIVER, which is the dividend

Lived’s arrangement one kind over, and for its reason: a whole-life body runs on a thread of its own and the awaited one is PINNED there, so drive is the author’s run on one row and the same run driven by this layer’s own block_on on the other. Every caller above this trait is written once — see Ignition::autonomous_declared, which is the one that matters.

The awaited face is NOT handed to Ignition::spawn, and that is the origin layer’s ruling read at this kind: that door demands Send, which would refuse the exact shape AsyncAutonomousOperator declines to bound — a node holding a model session, a device context, an FFI handle across its own awaits.

Required Associated Constants§

Source

const SYNC: bool

Whether THIS mode’s run answers without a future.

Driven::SYNC verbatim, one kind over: a graph root folds an ALL_SYNC over every mount it carries, and an autonomous mount has no Driven row for the emission to read one off. Set by the two blanket rows below and by nothing an author can write, so it PROVES rather than claims.

Required Associated Types§

Source

type In

The message this node consumes.

Source

type Out: 'static

The message it publishes.

Source

type Error

What a life that DIED refuses with.

Required Methods§

Source

fn drive( self, ctx: Context, upstreams: Upstreams<Self::In>, downstream: Downstream<Self::Out>, ) -> Result<Fin, Self::Error>

Take the three seats and run to an ending, ON THE CALLING THREAD.

It takes self BY VALUE because the faces do: a node of this kind is started once and there is nothing after it, so the value MOVES into the call — see AutonomousOperator’s lifecycle table, which is where that sentence and its consequences are written.

§Errors

Whatever this node’s own life refuses with — a body that DIED rather than reaching either ending. Both endings are Ok.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§

Source§

impl<O> Runs<Async> for O

The AWAITED row: implementing AsyncAutonomousOperator is implementing this, and the future is PINNED on the calling thread rather than spawned — see the trait’s own note for why.

Source§

impl<O> Runs<Block> for O

The BLOCKING row: implementing AutonomousOperator is implementing this, and run IS the drive.