mirror of
https://github.com/hexedtech/codemp.git
synced 2024-12-23 05:14:54 +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)]
|
||||
struct LoggerProducer(mpsc::Sender<String>);
|
||||
|
||||
|
@ -83,12 +89,12 @@ impl PyLogger {
|
|||
}
|
||||
|
||||
async fn listen(&self) -> Option<String> {
|
||||
self.0.lock().await.recv().await
|
||||
AllowThreads(Box::pin(self.0.lock().await.recv())).await
|
||||
}
|
||||
}
|
||||
|
||||
#[pymodule]
|
||||
fn codemp(_py: Python, m: &PyModule) -> PyResult<()> {
|
||||
fn codemp(m: &Bound<'_, PyModule>) -> PyResult<()> {
|
||||
m.add_class::<PyLogger>()?;
|
||||
|
||||
m.add_class::<TextChange>()?;
|
||||
|
|
Loading…
Reference in a new issue