extern crate std;
use crate::{StdioConfig, StdioError, StdioSystem, System};
use protoflow_core::{
prelude::{Bytes, String},
Block, BlockResult, BlockRuntime, InputPort, OutputPort,
};
use protoflow_derive::Block;
use simple_mermaid::mermaid;
#[doc = mermaid!("../../doc/sys/read_file.mmd")]
#[doc = mermaid!("../../doc/sys/read_file.seq.mmd" framed)]
#[derive(Block, Clone)]
pub struct ReadFile {
#[input]
pub path: InputPort<String>,
#[output]
pub output: OutputPort<Bytes>,
}
impl ReadFile {
pub fn new(path: InputPort<String>, output: OutputPort<Bytes>) -> Self {
Self { path, output }
}
}
impl Block for ReadFile {
fn execute(&mut self, _runtime: &dyn BlockRuntime) -> BlockResult {
unimplemented!() }
}
#[cfg(feature = "std")]
impl StdioSystem for ReadFile {
fn build_system(_config: StdioConfig) -> Result<System, StdioError> {
Ok(System::build(|_s| todo!())) }
}
#[cfg(test)]
mod tests {
use super::ReadFile;
use crate::{System, SystemBuilding};
#[test]
fn instantiate_block() {
let _ = System::build(|s| {
let _ = s.block(ReadFile::new(s.input(), s.output()));
});
}
}