1
2
3
4
5
6
7
8
9
10
11
12
use crate::{Error, Vm};

/// A primitive set.
///
/// [`PrimitiveSet`](PrimitiveSet)s provide primitive functionalities, such as
/// arithmetic and I/O, to [`Vm`](Vm)s. Each primitive has its own identifier.
pub trait PrimitiveSet: Sized {
    type Error: From<Error>;

    /// Runs a primitive on a virtual machine.
    fn operate(vm: &mut Vm<Self>, primitive: u8) -> Result<(), Self::Error>;
}