diff options
| author | s-ol <s+removethis@s-ol.nu> | 2026-01-23 18:10:39 +0000 |
|---|---|---|
| committer | s-ol <s+removethis@s-ol.nu> | 2026-01-23 18:10:39 +0000 |
| commit | d4366a4c12224da7ef3c08b9ca9d119da11b302a (patch) | |
| tree | 4b3f746e6fb071863bec80cf2e763e830226a9eb /src/node.rs | |
| parent | variadic arithmetic (diff) | |
| download | nodetoy-d4366a4c12224da7ef3c08b9ca9d119da11b302a.tar.gz nodetoy-d4366a4c12224da7ef3c08b9ca9d119da11b302a.zip | |
Error checking
Diffstat (limited to 'src/node.rs')
| -rw-r--r-- | src/node.rs | 14 |
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() |
