mirror of
https://github.com/hexedtech/codemp.git
synced 2024-11-22 15:24:48 +01:00
feat: make the automatic User translation into py,
fix: properly create the module with the new version signature
This commit is contained in:
parent
f8c36be6ea
commit
5acca5ce3e
1 changed files with 8 additions and 2 deletions
|
@ -31,6 +31,12 @@ impl From<crate::Error> for PyErr {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl IntoPy<PyObject> for crate::api::User {
|
||||||
|
fn into_py(self, py: Python<'_>) -> PyObject {
|
||||||
|
self.id.to_string().into_py(py)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
struct LoggerProducer(mpsc::Sender<String>);
|
struct LoggerProducer(mpsc::Sender<String>);
|
||||||
|
|
||||||
|
@ -83,12 +89,12 @@ impl PyLogger {
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn listen(&self) -> Option<String> {
|
async fn listen(&self) -> Option<String> {
|
||||||
self.0.lock().await.recv().await
|
AllowThreads(Box::pin(self.0.lock().await.recv())).await
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[pymodule]
|
#[pymodule]
|
||||||
fn codemp(_py: Python, m: &PyModule) -> PyResult<()> {
|
fn codemp(m: &Bound<'_, PyModule>) -> PyResult<()> {
|
||||||
m.add_class::<PyLogger>()?;
|
m.add_class::<PyLogger>()?;
|
||||||
|
|
||||||
m.add_class::<TextChange>()?;
|
m.add_class::<TextChange>()?;
|
||||||
|
|
Loading…
Reference in a new issue