use std::future::Future;
use crate::runtime::BlockId;
use crate::runtime::Error;
use crate::runtime::Pmt;
use crate::runtime::PortId;
use crate::runtime::Result;
use crate::runtime::buffer::BufferReader;
use crate::runtime::dev::BlockInbox;
use crate::runtime::dev::BlockMeta;
use crate::runtime::dev::MessageOutputs;
use crate::runtime::dev::WorkIo;
#[doc(hidden)]
pub trait SendKernelInterface: KernelInterface + Send
where
Self: KernelInterface<stream_ports_notify_finished(..): Send, call_handler(..): Send>,
{
}
impl<T> SendKernelInterface for T where
T: KernelInterface<stream_ports_notify_finished(..): Send, call_handler(..): Send> + Send
{
}
#[doc(hidden)]
pub trait KernelInterface {
fn is_blocking() -> bool;
fn type_name() -> &'static str;
fn stream_inputs(&self) -> Vec<String>;
fn stream_outputs(&self) -> Vec<String>;
fn stream_ports_init(&mut self, block_id: BlockId, inbox: BlockInbox);
fn stream_ports_validate(&self) -> Result<(), Error>;
fn stream_input_finish(&mut self, port_id: PortId) -> Result<(), Error>;
fn stream_ports_notify_finished(&mut self) -> impl Future<Output = ()>;
fn stream_input(&mut self, id: &PortId) -> Result<&mut dyn BufferReader, Error>;
fn connect_stream_output(
&mut self,
id: &PortId,
reader: &mut dyn BufferReader,
) -> Result<(), Error>;
fn message_inputs() -> &'static [&'static str];
fn message_outputs() -> &'static [&'static str];
fn call_handler(
&mut self,
_io: &mut WorkIo,
_mo: &mut MessageOutputs,
_meta: &mut BlockMeta,
id: PortId,
_p: Pmt,
) -> impl Future<Output = Result<Pmt, Error>>;
}