stak_vm/
primitive_set.rs

1use crate::{Exception, memory::Memory};
2use winter_maybe_async::maybe_async;
3
4/// A primitive set.
5///
6/// [`PrimitiveSet`](PrimitiveSet)s provide primitive functionalities, such as
7/// arithmetic and I/O, to [`Vm`](super::Vm)s. Each primitive has its own
8/// identifier.
9pub trait PrimitiveSet: Sized {
10    /// An error.
11    type Error: Exception;
12
13    /// Runs a primitive on a virtual machine.
14    #[maybe_async]
15    fn operate(&mut self, memory: &mut Memory, primitive: usize) -> Result<(), Self::Error>;
16}