aboutsummaryrefslogtreecommitdiffstats
path: root/src/node.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/node.rs')
-rw-r--r--src/node.rs14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/node.rs b/src/node.rs
index 3bcd73b..b63270e 100644
--- a/src/node.rs
+++ b/src/node.rs
@@ -5,6 +5,18 @@ use crate::library;
use crate::library::*;
use crate::types::{Type, TypeSignature};
+#[derive(Debug, Copy, Clone)]
+pub enum CompileError {
+ MissingArguments,
+ Codegen(fmt::Error),
+}
+
+impl From<fmt::Error> for CompileError {
+ fn from(v: fmt::Error) -> Self {
+ Self::Codegen(v)
+ }
+}
+
/// an instantiable Node, parametrized by its connected input types
#[enum_dispatch]
pub trait ConcreteNode {
@@ -24,7 +36,7 @@ pub trait ConcreteNode {
inputs: Vec<Option<String>>,
outputs: Vec<String>,
f: &mut dyn fmt::Write,
- ) -> fmt::Result;
+ ) -> Result<(), CompileError>;
fn show_body(&mut self, ui: &mut egui::Ui) -> egui::Response {
ui.response()