siglus_scene_vm/runtime/
opcode.rs1use anyhow::Result;
11
12use super::{forms, CommandContext, Value};
13
14#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
15pub struct OpCode {
16 pub id: u32,
17}
18
19impl OpCode {
20 pub const fn form(id: u32) -> Self {
21 Self { id }
22 }
23}
24
25pub fn dispatch_code(ctx: &mut CommandContext, code: OpCode, args: &[Value]) -> Result<bool> {
29 if let Some(h) = ctx.external_forms.clone() {
30 if h.dispatch_form(ctx, code.id, args)? {
31 return Ok(true);
32 }
33 }
34 forms::dispatch_form(ctx, code.id, args)
35}