use cu29::prelude::*;
use cu29_derive::copper_runtime;
#[derive(Reflect)]
struct IntSource;
impl Freezable for IntSource {}
impl CuSrcTask for IntSource {
type Resources<'r> = ();
type Output<'m> = output_msg!(i32);
fn new(_config: Option<&ComponentConfig>, _resources: Self::Resources<'_>) -> CuResult<Self> {
Ok(Self)
}
fn process(&mut self, _ctx: &CuContext, output: &mut Self::Output<'_>) -> CuResult<()> {
output.set_payload(7);
Ok(())
}
}
#[derive(Reflect)]
struct MultiRegular;
impl Freezable for MultiRegular {}
impl CuTask for MultiRegular {
type Resources<'r> = ();
type Input<'m> = input_msg!(i32);
type Output<'m> = output_msg!(i32, bool);
fn new(_config: Option<&ComponentConfig>, _resources: Self::Resources<'_>) -> CuResult<Self> {
Ok(Self)
}
fn process(
&mut self,
_ctx: &CuContext,
input: &Self::Input<'_>,
output: &mut Self::Output<'_>,
) -> CuResult<()> {
output.0.set_payload(input.payload().copied().unwrap_or_default());
output.1.set_payload(true);
Ok(())
}
}
#[derive(Reflect)]
struct IntSink;
impl Freezable for IntSink {}
impl CuSinkTask for IntSink {
type Resources<'r> = ();
type Input<'m> = input_msg!(i32);
fn new(_config: Option<&ComponentConfig>, _resources: Self::Resources<'_>) -> CuResult<Self> {
Ok(Self)
}
fn process(&mut self, _ctx: &CuContext, _input: &Self::Input<'_>) -> CuResult<()> {
Ok(())
}
}
#[copper_runtime(
config = "config/multi_output_task_subset_valid.ron",
sim_mode = true,
ignore_resources = true
)]
struct App {}
fn main() {}