feat: make the automatic User translation into py,

fix: properly create the module with the new version signature
This commit is contained in:
cschen 2024-08-17 01:11:11 +02:00
parent f8c36be6ea
commit 5acca5ce3e

View file

@ -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>()?;