File tree Expand file tree Collapse file tree 4 files changed +31
-2
lines changed
Expand file tree Collapse file tree 4 files changed +31
-2
lines changed Original file line number Diff line number Diff line change 1+ pub struct Context {
2+
3+ }
Original file line number Diff line number Diff line change 1+ pub mod signal;
2+ pub mod context;
3+
14use crate :: error:: RuntimeError ;
25use std:: {
36 collections:: { HashMap , VecDeque } ,
Original file line number Diff line number Diff line change 1+ use tucana:: shared:: Value ;
2+ use crate :: error:: RuntimeError ;
3+
4+ #[ derive( Debug ) ]
5+ pub enum Signal {
6+ Success ( Value ) ,
7+ Failure ( RuntimeError ) ,
8+ Return ( Value ) ,
9+ Stop
10+ }
11+
12+ impl PartialEq for Signal {
13+ fn eq ( & self , other : & Self ) -> bool {
14+ matches ! (
15+ ( self , other) ,
16+ ( Signal :: Success ( _) , Signal :: Success ( _) )
17+ | ( Signal :: Failure ( _) , Signal :: Failure ( _) )
18+ | ( Signal :: Return ( _) , Signal :: Return ( _) )
19+ | ( Signal :: Stop , Signal :: Stop )
20+ )
21+ }
22+ }
Original file line number Diff line number Diff line change 1- use crate :: { context:: Context , error :: RuntimeError } ;
1+ use crate :: { context:: Context } ;
22use std:: collections:: HashMap ;
33use tucana:: shared:: Value ;
4+ use crate :: context:: signal:: Signal ;
45
5- pub type HandlerFn = fn ( & [ Value ] , & mut Context ) -> Result < Value , RuntimeError > ;
6+ pub type HandlerFn = fn ( & [ Value ] , & mut Context ) -> Signal ;
67
78/// Holds all registered handlers.
89pub struct FunctionStore {
You can’t perform that action at this time.
0 commit comments