Trait PortList

Source
pub trait PortList<S>: Variadic + Sealed<S>
where S: Polarity,
{ type Ctx<'a>: Variadic; // Required methods fn set_graph_meta( &self, handoffs: &mut SlotVec<HandoffTag, HandoffData>, out_handoff_ids: &mut Vec<HandoffId>, sg_id: SubgraphId, handoffs_are_preds: bool, ); unsafe fn make_ctx<'a>( &self, handoffs: &'a SlotVec<HandoffTag, HandoffData>, ) -> Self::Ctx<'a>; fn assert_is_from(&self, handoffs: &SlotVec<HandoffTag, HandoffData>); }
Expand description

Sealed trait for variadic lists of ports.

See the [variadics] crate for the strategy we use to implement variadics in Rust.

Required Associated Types§

Source

type Ctx<'a>: Variadic

The [Variadic] return type of Self::make_ctx.

Required Methods§

Source

fn set_graph_meta( &self, handoffs: &mut SlotVec<HandoffTag, HandoffData>, out_handoff_ids: &mut Vec<HandoffId>, sg_id: SubgraphId, handoffs_are_preds: bool, )

Iteratively/recursively set the graph metadata for each port in this list.

Specifically sets:

  • HandoffData::preds and HandoffData::succs in the handoffs slice for the handoffs in this PortList (using pred and/or succ).
  • out_handoff_ids will be extended with all the handoff IDs in this PortList.

handoffs_are_preds:

  • true: Handoffs are predecessors (inputs) to subgraph sg_id.
  • false: Handoffs are successors (outputs) from subgraph sg_id.
Source

unsafe fn make_ctx<'a>( &self, handoffs: &'a SlotVec<HandoffTag, HandoffData>, ) -> Self::Ctx<'a>

Iteratively/recursively construct a Ctx variadic list.

(Note that unlike Self::set_graph_meta, this does not mess with pred/succ handoffs for teeing).

§Safety

The handoffs in this port list (self) must come from the handoffs SlotVec. This ensure the types will match.

Use Self::assert_is_from to check this.

Source

fn assert_is_from(&self, handoffs: &SlotVec<HandoffTag, HandoffData>)

Asserts that self is a valid port list from handoffs. Panics if not.

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.

Implementations on Foreign Types§

Source§

impl<S> PortList<S> for ()
where S: Polarity,

Source§

type Ctx<'a> = ()

Source§

fn set_graph_meta( &self, _handoffs: &mut SlotVec<HandoffTag, HandoffData>, _out_handoff_ids: &mut Vec<HandoffId>, _sg_id: SubgraphId, _handoffs_are_preds: bool, )

Source§

unsafe fn make_ctx<'a>( &self, _handoffs: &'a SlotVec<HandoffTag, HandoffData>, ) -> Self::Ctx<'a>

Source§

fn assert_is_from(&self, _handoffs: &SlotVec<HandoffTag, HandoffData>)

Source§

impl<S, Rest, H> PortList<S> for (Port<S, H>, Rest)
where S: Polarity, H: Handoff, Rest: PortList<S>,

Source§

type Ctx<'a> = (&'a PortCtx<S, H>, <Rest as PortList<S>>::Ctx<'a>)

Source§

fn set_graph_meta( &self, handoffs: &mut SlotVec<HandoffTag, HandoffData>, out_handoff_ids: &mut Vec<HandoffId>, sg_id: SubgraphId, handoffs_are_preds: bool, )

Source§

unsafe fn make_ctx<'a>( &self, handoffs: &'a SlotVec<HandoffTag, HandoffData>, ) -> Self::Ctx<'a>

Source§

fn assert_is_from(&self, handoffs: &SlotVec<HandoffTag, HandoffData>)

Implementors§