-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
131 additions
and
67 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
use pyo3::prelude::*; | ||
use crate::utils::create_interface; | ||
use keygen_rs::component::Component as KeygenRsComponent; | ||
|
||
#[pymodule(name = "component")] | ||
pub fn component_module(m: &Bound<'_, PyModule>) -> PyResult<()> { | ||
// Hack: workaround for https://github.com/PyO3/pyo3/issues/759 | ||
Python::with_gil(|py| { | ||
py.import("sys")? | ||
.getattr("modules")? | ||
.set_item("keygen_sh.component", m) | ||
})?; | ||
|
||
m.add_class::<Component>()?; | ||
Ok(()) | ||
} | ||
|
||
create_interface!(Component, KeygenRsComponent); | ||
|
||
#[pymethods] | ||
impl Component { | ||
#[new] | ||
pub fn new(id: String, fingerprint: String, name: String) -> Self { | ||
Self { | ||
inner: KeygenRsComponent { id, fingerprint, name } | ||
} | ||
} | ||
|
||
// pub fn create_object(&self) -> serde_json::Value { | ||
// let object = KeygenRsComponent::create_object(&self.inner); | ||
// | ||
// match object { | ||
// _ => object, | ||
// } | ||
// } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.