forked from Orchid/orchid
Protocols and operators mostly
This commit is contained in:
@@ -31,6 +31,19 @@ trait_set! {
|
||||
trait FunCB = Fn(Vec<Expr>) -> LocalBoxFuture<'static, OrcRes<GExpr>> + 'static;
|
||||
}
|
||||
|
||||
task_local! {
|
||||
static ARGV: Vec<Expr>;
|
||||
}
|
||||
|
||||
pub fn get_arg(idx: usize) -> Expr {
|
||||
ARGV
|
||||
.try_with(|argv| {
|
||||
(argv.get(idx).cloned())
|
||||
.unwrap_or_else(|| panic!("Cannot read argument ##{idx}, only have {}", argv.len()))
|
||||
})
|
||||
.expect("get_arg called outside ExprFunc")
|
||||
}
|
||||
|
||||
pub trait ExprFunc<I, O>: Clone + 'static {
|
||||
fn argtyps() -> &'static [TypeId];
|
||||
fn apply<'a>(&self, hand: ExecHandle<'a>, v: Vec<Expr>) -> impl Future<Output = OrcRes<GExpr>>;
|
||||
|
||||
Reference in New Issue
Block a user