mirror of
https://github.com/hexedtech/codemp.git
synced 2024-11-22 15:24:48 +01:00
feat: updated workspace manually anyway even if commented so that we have it ready just in case
This commit is contained in:
parent
ef2285d0f3
commit
f8c36be6ea
1 changed files with 28 additions and 76 deletions
|
@ -1,30 +1,24 @@
|
||||||
|
// We no can simply define decorate the pub impl block of workspace with
|
||||||
|
// #[pymethods], which means that this module is not really necessary anymore.
|
||||||
|
// In any case we will leave it here for the time being in case we need to come back to
|
||||||
|
// the manual version.
|
||||||
|
|
||||||
// use crate::buffer::Controller as BufferController;
|
// use crate::buffer::Controller as BufferController;
|
||||||
// use crate::cursor::Controller as CursorController;
|
// use crate::cursor::Controller as CursorController;
|
||||||
// use crate::workspace::Workspace;
|
// use crate::workspace::Workspace;
|
||||||
// use pyo3::prelude::*;
|
// use pyo3::prelude::*;
|
||||||
// use pyo3::types::PyString;
|
|
||||||
|
|
||||||
// #[pymethods]
|
// #[pymethods]
|
||||||
// impl Workspace {
|
// impl Workspace {
|
||||||
// // join a workspace
|
// // join a workspace
|
||||||
// #[pyo3(name = "create")]
|
// #[pyo3(name = "create")]
|
||||||
// fn pycreate<'p>(&'p self, py: Python<'p>, path: String) -> PyResult<&'p PyAny> {
|
// async fn pycreate(&self, path: String) -> crate::Result<()> {
|
||||||
// let ws = self.clone();
|
// self.create(path.as_str()).await
|
||||||
|
|
||||||
// pyo3_asyncio::tokio::future_into_py(py, async move {
|
|
||||||
// ws.create(path.as_str()).await?;
|
|
||||||
// Ok(())
|
|
||||||
// })
|
|
||||||
// }
|
// }
|
||||||
// #[pyo3(name = "attach")]
|
|
||||||
// fn pyattach<'p>(&'p self, py: Python<'p>, path: String) -> PyResult<&PyAny> {
|
|
||||||
// let ws = self.clone();
|
|
||||||
|
|
||||||
// pyo3_asyncio::tokio::future_into_py(py, async move {
|
// #[pyo3(name = "attach")]
|
||||||
// let buffctl: BufferController = ws.attach(path.as_str()).await?;
|
// async fn pyattach(&self, path: String) -> crate::Result<BufferController> {
|
||||||
// Ok(buffctl)
|
// Ok(self.attach(path.as_str()).await?)
|
||||||
// // Python::with_gil(|py| Py::new(py, buffctl))
|
|
||||||
// })
|
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// #[pyo3(name = "detach")]
|
// #[pyo3(name = "detach")]
|
||||||
|
@ -36,79 +30,44 @@
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// // #[pyo3(name = "event")]
|
// #[pyo3(name = "event")]
|
||||||
// // fn pyevent(&self, py: Python<'_>, path: String) -> PyResult<&PyAny> {
|
// async fn pyevent(&self) -> crate::Result<crate::api::Event> {
|
||||||
// // let rc = self.clone();
|
// self.event().await
|
||||||
// // future_into_py(py, async move { Ok(rc.event().await?) })
|
// }
|
||||||
// // }
|
|
||||||
|
|
||||||
// #[pyo3(name = "fetch_buffers")]
|
// #[pyo3(name = "fetch_buffers")]
|
||||||
// fn pyfetch_buffers<'p>(&'p self, py: Python<'p>) -> PyResult<&PyAny> {
|
// async fn pyfetch_buffers(&self) -> crate::Result<()> {
|
||||||
// let ws = self.clone();
|
// self.fetch_buffers().await
|
||||||
|
|
||||||
// pyo3_asyncio::tokio::future_into_py(py, async move {
|
|
||||||
// ws.fetch_buffers().await?;
|
|
||||||
// Ok(())
|
|
||||||
// })
|
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// #[pyo3(name = "fetch_users")]
|
// #[pyo3(name = "fetch_users")]
|
||||||
// fn pyfetch_users<'p>(&'p self, py: Python<'p>) -> PyResult<&PyAny> {
|
// async fn pyfetch_users(&self) -> crate::Result<()> {
|
||||||
// let ws = self.clone();
|
// self.fetch_users().await
|
||||||
|
|
||||||
// pyo3_asyncio::tokio::future_into_py(py, async move {
|
|
||||||
// ws.fetch_users().await?;
|
|
||||||
// Ok(())
|
|
||||||
// })
|
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// #[pyo3(name = "list_buffer_users")]
|
// #[pyo3(name = "list_buffer_users")]
|
||||||
// fn pylist_buffer_users<'p>(&'p self, py: Python<'p>, path: String) -> PyResult<&PyAny> {
|
// async fn pylist_buffer_users(&self, path: String) -> crate::Result<Vec<crate::api::User>> {
|
||||||
// let ws = self.clone();
|
// self.list_buffer_users(path.as_str()).await
|
||||||
|
|
||||||
// pyo3_asyncio::tokio::future_into_py(py, async move {
|
|
||||||
// let usrlist: Vec<String> = ws
|
|
||||||
// .list_buffer_users(path.as_str())
|
|
||||||
// .await?
|
|
||||||
// .into_iter()
|
|
||||||
// .map(|e| e.id)
|
|
||||||
// .collect();
|
|
||||||
|
|
||||||
// Ok(usrlist)
|
|
||||||
// })
|
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// #[pyo3(name = "delete")]
|
// #[pyo3(name = "delete")]
|
||||||
// fn pydelete<'p>(&'p self, py: Python<'p>, path: String) -> PyResult<&PyAny> {
|
// async fn pydelete(&self, path: String) -> crate::Result<()> {
|
||||||
// let ws = self.clone();
|
// self.delete(path.as_str()).await
|
||||||
|
|
||||||
// pyo3_asyncio::tokio::future_into_py(py, async move {
|
|
||||||
// ws.delete(path.as_str()).await?;
|
|
||||||
// Ok(())
|
|
||||||
// })
|
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// #[pyo3(name = "id")]
|
// #[pyo3(name = "id")]
|
||||||
// fn pyid(&self, py: Python<'_>) -> Py<PyString> {
|
// fn pyid(&self) -> String {
|
||||||
// PyString::new(py, self.id().as_str()).into()
|
// self.id()
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// #[pyo3(name = "cursor")]
|
// #[pyo3(name = "cursor")]
|
||||||
// fn pycursor(&self, py: Python<'_>) -> PyResult<Py<CursorController>> {
|
// fn pycursor(&self) -> CursorController {
|
||||||
// Py::new(py, self.cursor())
|
// self.cursor()
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// #[pyo3(name = "buffer_by_name")]
|
// #[pyo3(name = "buffer_by_name")]
|
||||||
// fn pybuffer_by_name(
|
// fn pybuffer_by_name(&self, path: String) -> Option<BufferController> {
|
||||||
// &self,
|
// self.buffer_by_name(path.as_str())
|
||||||
// py: Python<'_>,
|
|
||||||
// path: String,
|
|
||||||
// ) -> PyResult<Option<Py<BufferController>>> {
|
|
||||||
// let Some(bufctl) = self.buffer_by_name(path.as_str()) else {
|
|
||||||
// return Ok(None);
|
|
||||||
// };
|
|
||||||
|
|
||||||
// Ok(Some(Py::new(py, bufctl)?))
|
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// #[pyo3(name = "buffer_list")]
|
// #[pyo3(name = "buffer_list")]
|
||||||
|
@ -121,10 +80,3 @@
|
||||||
// self.filetree()
|
// self.filetree()
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// #[pyclass]
|
|
||||||
// enum PyEvent {
|
|
||||||
// FileTreeUpdated,
|
|
||||||
// UserJoin { name: String },
|
|
||||||
// UserLeave { name: String },
|
|
||||||
// }
|
|
||||||
|
|
Loading…
Reference in a new issue