terrified to start testing
This commit is contained in:
@@ -5,9 +5,7 @@ use itertools::Itertools;
|
||||
use orchid_api_derive::{Coding, Hierarchy};
|
||||
use orchid_api_traits::Request;
|
||||
|
||||
use crate::{
|
||||
ExprTicket, Expression, ExtHostReq, FormattingUnit, HostExtReq, OrcResult, SysId, TStrv,
|
||||
};
|
||||
use crate::{ExprTicket, Expression, ExtHostReq, FormattingUnit, HostExtReq, SysId, TStrv};
|
||||
|
||||
#[derive(Clone, Coding)]
|
||||
pub struct AtomData(pub Vec<u8>);
|
||||
@@ -97,8 +95,8 @@ impl Request for DeserAtom {
|
||||
/// A request blindly routed to the system that provides an atom.
|
||||
#[derive(Clone, Debug, Coding, Hierarchy)]
|
||||
#[extends(AtomReq, HostExtReq)]
|
||||
pub struct Fwded(pub Atom, pub TStrv, pub Vec<u8>);
|
||||
impl Request for Fwded {
|
||||
pub struct FinalFwded(pub Atom, pub TStrv, pub Vec<u8>);
|
||||
impl Request for FinalFwded {
|
||||
type Response = Option<Vec<u8>>;
|
||||
}
|
||||
|
||||
@@ -109,32 +107,6 @@ impl Request for Fwd {
|
||||
type Response = Option<Vec<u8>>;
|
||||
}
|
||||
|
||||
/// What to do after a command has finished executing
|
||||
#[derive(Clone, Debug, Coding)]
|
||||
pub enum NextStep {
|
||||
/// Add more work. Parallel work is fairly executed in parallel, so different
|
||||
/// command chains can block on each other. When the command queue is empty,
|
||||
/// the interpreter may exit without waiting for timers.
|
||||
Continue {
|
||||
/// Run these commands immediately. Since timers don't keep the interpreter
|
||||
/// alive, this should usually be non-empty, but this is not required.
|
||||
immediate: Vec<Expression>,
|
||||
/// Schedule these commands after the specified number of milliseconds, if
|
||||
/// the interpreter had not exited by then.
|
||||
delayed: Vec<(NonZeroU64, Expression)>,
|
||||
},
|
||||
/// Discard the rest of the queue and exit. It is possible to fail the program
|
||||
/// without raising an error because the convention on most OSes is to
|
||||
/// separate error reporting from a failure exit.
|
||||
Exit { success: bool },
|
||||
}
|
||||
#[derive(Clone, Debug, Coding, Hierarchy)]
|
||||
#[extends(AtomReq, HostExtReq)]
|
||||
pub struct Command(pub Atom);
|
||||
impl Request for Command {
|
||||
type Response = OrcResult<NextStep>;
|
||||
}
|
||||
|
||||
/// Notification that an atom is being dropped because its associated expression
|
||||
/// isn't referenced anywhere. This should have no effect if the atom's `drop`
|
||||
/// flag is false.
|
||||
@@ -166,8 +138,8 @@ impl Request for ExtAtomPrint {
|
||||
pub enum AtomReq {
|
||||
CallRef(CallRef),
|
||||
FinalCall(FinalCall),
|
||||
Fwded(Fwded),
|
||||
Command(Command),
|
||||
FwdedRef(FinalFwded),
|
||||
FinalFwded(FinalFwded),
|
||||
AtomPrint(AtomPrint),
|
||||
SerializeAtom(SerializeAtom),
|
||||
}
|
||||
@@ -177,9 +149,9 @@ impl AtomReq {
|
||||
pub fn get_atom(&self) -> &Atom {
|
||||
match self {
|
||||
Self::CallRef(CallRef(a, ..))
|
||||
| Self::Command(Command(a))
|
||||
| Self::FinalCall(FinalCall(a, ..))
|
||||
| Self::Fwded(Fwded(a, ..))
|
||||
| Self::FwdedRef(FinalFwded(a, ..))
|
||||
| Self::FinalFwded(FinalFwded(a, ..))
|
||||
| Self::AtomPrint(AtomPrint(a))
|
||||
| Self::SerializeAtom(SerializeAtom(a)) => a,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user