Migrate pass through and value node to identity implementation

This commit is contained in:
Adam
2025-07-06 13:23:24 -07:00
parent 007812077b
commit 7ecd1d0054
11 changed files with 83 additions and 68 deletions

View File

@@ -13,28 +13,28 @@ impl<'i, const N: u32, I> Node<'i, I> for IntNode<N> {
}
}
// #[derive(Default, Debug, Clone, Copy)]
// pub struct ValueNode<T>(pub T);
#[derive(Default, Debug, Clone, Copy)]
pub struct ValueNode<T>(pub T);
// impl<'i, T: 'i, I> Node<'i, I> for ValueNode<T> {
// type Output = &'i T;
// #[inline(always)]
// fn eval(&'i self, _input: I) -> Self::Output {
// &self.0
// }
// }
impl<'i, T: 'i, I> Node<'i, I> for ValueNode<T> {
type Output = &'i T;
#[inline(always)]
fn eval(&'i self, _input: I) -> Self::Output {
&self.0
}
}
// impl<T> ValueNode<T> {
// pub const fn new(value: T) -> ValueNode<T> {
// ValueNode(value)
// }
// }
impl<T> ValueNode<T> {
pub const fn new(value: T) -> ValueNode<T> {
ValueNode(value)
}
}
// impl<T> From<T> for ValueNode<T> {
// fn from(value: T) -> Self {
// ValueNode::new(value)
// }
// }
impl<T> From<T> for ValueNode<T> {
fn from(value: T) -> Self {
ValueNode::new(value)
}
}
#[derive(Default, Debug, Clone, Copy)]
pub struct AsRefNode<T: AsRef<U>, U>(pub T, PhantomData<U>);