Trait hydroflow::scheduled::handoff::Handoff

source ·
pub trait Handoff: Default + HandoffMeta {
    type Inner;

    // Required methods
    fn take_inner(&self) -> Self::Inner;
    fn borrow_mut_swap(&self) -> RefMut<'_, Self::Inner>;

    // Provided methods
    fn give<T>(&self, item: T) -> T
       where Self: CanReceive<T> { ... }
    fn try_give<T>(&self, item: T) -> Result<T, T>
       where Self: TryCanReceive<T> { ... }
}
Expand description

Trait for handoffs to implement.

Required Associated Types§

source

type Inner

Inner datastructure type.

Required Methods§

source

fn take_inner(&self) -> Self::Inner

Take the inner datastructure, similar to std::mem::take.

source

fn borrow_mut_swap(&self) -> RefMut<'_, Self::Inner>

Take the inner datastructure by swapping input and output buffers.

For better performance over Self::take_inner.

Provided Methods§

source

fn give<T>(&self, item: T) -> T
where Self: CanReceive<T>,

source

fn try_give<T>(&self, item: T) -> Result<T, T>
where Self: TryCanReceive<T>,

Object Safety§

This trait is not object safe.

Implementors§

source§

impl<T> Handoff for TeeingHandoff<T>

§

type Inner = VecDeque<Vec<T>>

source§

impl<T> Handoff for VecHandoff<T>

§

type Inner = Vec<T>