aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/lib.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib.rs')
-rw-r--r--src/lib.rs57
1 files changed, 0 insertions, 57 deletions
diff --git a/src/lib.rs b/src/lib.rs
index 5b7d6a1..6f069e2 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -1,4 +1,3 @@
-use clap::builder::Str;
use pyo3::prelude::*;
use pyo3::wrap_pyfunction;
@@ -8,65 +7,9 @@ fn process_rule_pack(rule_pack: &str) -> PyResult<String> {
Ok(format!("Processed rule pack: {}", rule_pack))
}
-#[pyclass]
-struct Integer {
- inner: i32,
-}
-
-// A "tuple" struct
-#[pyclass]
-struct Number(i32);
-
-// PyO3 supports custom discriminants in enums
-#[pyclass]
-enum HttpResponse {
- Ok = 200,
- NotFound = 404,
- Teapot = 418,
- // ...
-}
-
-use pyo3::exceptions::PyValueError;
-use pyo3::prelude::*;
-use pyo3::types::PyString;
-
-#[pyclass]
-#[derive(Debug, Clone)]
-enum RuleLoadType {
- DIR,
- NAME,
- FILE,
- CLASS,
-}
-
-#[pymethods]
-impl RuleLoadType {
- #[staticmethod]
- fn from_str(s: &str) -> PyResult<Self> {
- match s {
- "dir" => Ok(RuleLoadType::DIR),
- "name" => Ok(RuleLoadType::NAME),
- "file" => Ok(RuleLoadType::FILE),
- "class" => Ok(RuleLoadType::CLASS),
- _ => Err(PyValueError::new_err("Invalid value for RuleLoadType")),
- }
- }
-
- fn __str__(&self) -> PyResult<String> {
- Ok(match self {
- RuleLoadType::DIR => "dir",
- RuleLoadType::NAME => "name",
- RuleLoadType::FILE => "file",
- RuleLoadType::CLASS => "class",
- }
- .to_string())
- }
-}
-
#[pymodule]
#[pyo3(name = "LibCore")]
fn libcore(_py: Python, m: &PyModule) -> PyResult<()> {
m.add_function(wrap_pyfunction!(process_rule_pack, m)?)?;
- m.add_class::<RuleLoadType>()?;
Ok(())
}