use crate::node;
use gantz_ca::CaHash;
use gantz_nodetag::NodeTag;
use serde::{Deserialize, Serialize};
pub const IDENTITY_NAME: &str = "id";
#[derive(Clone, Debug, Default, Eq, Hash, PartialEq, Deserialize, Serialize, CaHash, NodeTag)]
#[cahash("gantz.identity")]
pub struct Identity;
impl node::Node for Identity {
fn n_inputs(&self, _ctx: node::MetaCtx) -> usize {
1
}
fn n_outputs(&self, _ctx: node::MetaCtx) -> usize {
1
}
fn expr(&self, ctx: node::ExprCtx<'_, '_>) -> node::ExprResult {
let inputs = ctx.inputs();
let expr = match inputs.get(0) {
Some(Some(input)) => input.clone(),
_ => "'()".to_string(),
};
node::parse_expr(&expr)
}
}