mirror of
https://github.com/gorules/zen.git
synced 2026-10-05 08:02:28 +00:00
feat: custom node (#138)
* feat: custom node * add zen template, expose $nodes and $root * add custom handler to go and nodejs * add support for python, improve bindings, add error to zen template * fix: correct binding exports for nodejs and python * fix benchmark * improve rust api, trim template in zen templates * update cargo action * update expression version * compile action * fix action format
This commit is contained in:
@@ -1,19 +1,23 @@
|
||||
use crate::engine::PyZenEvaluateOptions;
|
||||
use crate::loader::PyDecisionLoader;
|
||||
use crate::value::PyValue;
|
||||
use std::sync::Arc;
|
||||
|
||||
use anyhow::{anyhow, Context};
|
||||
use pyo3::types::PyDict;
|
||||
use pyo3::{pyclass, pymethods, PyObject, PyResult, Python, ToPyObject};
|
||||
use pythonize::depythonize;
|
||||
use std::sync::Arc;
|
||||
|
||||
use zen_engine::{Decision, EvaluationOptions};
|
||||
|
||||
use crate::custom_node::PyCustomNode;
|
||||
use crate::engine::PyZenEvaluateOptions;
|
||||
use crate::loader::PyDecisionLoader;
|
||||
use crate::value::PyValue;
|
||||
|
||||
#[pyclass]
|
||||
#[pyo3(name = "ZenDecision")]
|
||||
pub struct PyZenDecision(pub(crate) Arc<Decision<PyDecisionLoader>>);
|
||||
pub struct PyZenDecision(pub(crate) Arc<Decision<PyDecisionLoader, PyCustomNode>>);
|
||||
|
||||
impl From<Decision<PyDecisionLoader>> for PyZenDecision {
|
||||
fn from(value: Decision<PyDecisionLoader>) -> Self {
|
||||
impl From<Decision<PyDecisionLoader, PyCustomNode>> for PyZenDecision {
|
||||
fn from(value: Decision<PyDecisionLoader, PyCustomNode>) -> Self {
|
||||
Self(value.into())
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user