feat(pyargus): add temporal operators to bindings
This commit is contained in:
parent
bfd5178982
commit
4b4d02a0ec
2 changed files with 54 additions and 1 deletions
|
|
@ -3,12 +3,12 @@ name = "pyargus"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
|
||||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
|
||||||
[lib]
|
[lib]
|
||||||
name = "pyargus"
|
name = "pyargus"
|
||||||
crate-type = ["cdylib"]
|
crate-type = ["cdylib"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
argus-core = { version = "0.1.0", path = "../argus-core" }
|
argus-core = { version = "0.1.0", path = "../argus-core" }
|
||||||
|
argus-semantics = { version = "0.1.0", path = "../argus-semantics" }
|
||||||
derive_more = "0.99.17"
|
derive_more = "0.99.17"
|
||||||
pyo3 = "0.18.1"
|
pyo3 = "0.18.1"
|
||||||
|
|
|
||||||
|
|
@ -318,6 +318,55 @@ impl Or {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[pyclass(extends=PyBoolExpr)]
|
||||||
|
struct Next;
|
||||||
|
|
||||||
|
#[pymethods]
|
||||||
|
impl Next {
|
||||||
|
#[new]
|
||||||
|
fn new(arg: PyBoolExpr) -> (Self, PyBoolExpr) {
|
||||||
|
let arg = arg.0;
|
||||||
|
(Self, PyBoolExpr(Box::new(BoolExpr::Next { arg })))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[pyclass(extends=PyBoolExpr)]
|
||||||
|
struct Always;
|
||||||
|
|
||||||
|
#[pymethods]
|
||||||
|
impl Always {
|
||||||
|
#[new]
|
||||||
|
fn new(arg: PyBoolExpr) -> (Self, PyBoolExpr) {
|
||||||
|
let arg = arg.0;
|
||||||
|
(Self, PyBoolExpr(Box::new(BoolExpr::Always { arg })))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[pyclass(extends=PyBoolExpr)]
|
||||||
|
struct Eventually;
|
||||||
|
|
||||||
|
#[pymethods]
|
||||||
|
impl Eventually {
|
||||||
|
#[new]
|
||||||
|
fn new(arg: PyBoolExpr) -> (Self, PyBoolExpr) {
|
||||||
|
let arg = arg.0;
|
||||||
|
(Self, PyBoolExpr(Box::new(BoolExpr::Eventually { arg })))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[pyclass(extends=PyBoolExpr)]
|
||||||
|
struct Until;
|
||||||
|
|
||||||
|
#[pymethods]
|
||||||
|
impl Until {
|
||||||
|
#[new]
|
||||||
|
fn new(lhs: PyBoolExpr, rhs: PyBoolExpr) -> (Self, PyBoolExpr) {
|
||||||
|
let lhs = lhs.0;
|
||||||
|
let rhs = rhs.0;
|
||||||
|
(Self, PyBoolExpr(Box::new(BoolExpr::Until { lhs, rhs })))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[pymodule]
|
#[pymodule]
|
||||||
#[pyo3(name = "_argus")]
|
#[pyo3(name = "_argus")]
|
||||||
fn pyargus(_py: Python, m: &PyModule) -> PyResult<()> {
|
fn pyargus(_py: Python, m: &PyModule) -> PyResult<()> {
|
||||||
|
|
@ -340,6 +389,10 @@ fn pyargus(_py: Python, m: &PyModule) -> PyResult<()> {
|
||||||
m.add_class::<Not>()?;
|
m.add_class::<Not>()?;
|
||||||
m.add_class::<And>()?;
|
m.add_class::<And>()?;
|
||||||
m.add_class::<Or>()?;
|
m.add_class::<Or>()?;
|
||||||
|
m.add_class::<Next>()?;
|
||||||
|
m.add_class::<Always>()?;
|
||||||
|
m.add_class::<Eventually>()?;
|
||||||
|
m.add_class::<Until>()?;
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue