Construct value nodes as native record sources

This commit is contained in:
Dennis Kobert
2026-08-06 10:24:44 +00:00
parent 7a1d1f3238
commit 886ff03ef2
4 changed files with 35 additions and 24 deletions

View File

@@ -13,6 +13,13 @@ pub fn value_edge<T: Clone + crate::WasmNotSend + crate::WasmNotSync + 'static>(
crate::registry::EdgeHandle::new(std::sync::Arc::new(ClonedNode(value)) as std::sync::Arc<crate::registry::ErasedNode<T>>)
}
/// The native record edge of a constant: the element lifts onto the record
/// wire per evaluation, so value sources need no spliced adapter.
pub fn record_value_edge<T: Clone + Send + Sync + 'static>(value: T) -> crate::registry::EdgeHandle {
let node = crate::record::RecordLift::<T, _>::new(ClonedNode(value));
crate::registry::EdgeHandle::new_record::<T>(std::sync::Arc::new(node) as std::sync::Arc<crate::registry::ErasedRecordNode>)
}
impl<T: Clone> ClonedNode<T> {
pub const fn new(value: T) -> ClonedNode<T> {
ClonedNode(value)