mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-15 22:28:10 +08:00
* Restructure node-graph folder * Fix wasm compilation * Move node definitions out of *-types crates * Cleanup * Fix warnings * Fix warnings * Start adding migrations * Add migrations and move memo nodes to gcore * Move nodes/gsvg-render -> rendering * Replace some hard coded identifiers and fix automatic conversion * Fix Vec2Value node migration * Fix formatting * Add more migrations * Cleanup features * Fix core_types::raster import * Update demo artwork (to make profile ci work) * Move *-types to node-graph/libraries folder * Add missing node migrations * Migrate more nodes * Remove impure memo node * More fixes and remove warning * Migrate context and add a few missing migrations --------- Co-authored-by: Keavon Chambers <keavon@keavon.com>
28 lines
880 B
Rust
28 lines
880 B
Rust
use core_types::NodeIO;
|
|
use core_types::WasmNotSend;
|
|
pub use core_types::registry::{DowncastBothNode, DynAnyNode, FutureWrapperNode, PanicNode};
|
|
pub use core_types::{Node, generic, ops};
|
|
use dyn_any::StaticType;
|
|
pub use graph_craft::proto::{Any, NodeContainer, TypeErasedBox, TypeErasedNode};
|
|
use graph_craft::proto::{FutureAny, SharedNodeContainer};
|
|
|
|
pub trait IntoTypeErasedNode<'n> {
|
|
fn into_type_erased(self) -> TypeErasedBox<'n>;
|
|
}
|
|
|
|
impl<'n, N: 'n> IntoTypeErasedNode<'n> for N
|
|
where
|
|
N: for<'i> NodeIO<'i, Any<'i>, Output = FutureAny<'i>> + Sync + WasmNotSend,
|
|
{
|
|
fn into_type_erased(self) -> TypeErasedBox<'n> {
|
|
Box::new(self)
|
|
}
|
|
}
|
|
|
|
pub fn input_node<O: StaticType>(n: SharedNodeContainer) -> DowncastBothNode<(), O> {
|
|
downcast_node(n)
|
|
}
|
|
pub fn downcast_node<I: StaticType, O: StaticType>(n: SharedNodeContainer) -> DowncastBothNode<I, O> {
|
|
DowncastBothNode::new(n)
|
|
}
|