Replies: 1 comment 1 reply
-
I think you want this code: #[pyclass]
struct Test {
lines: Vec<String>,
}
#[pymethods]
impl Test {
#[new]
fn __new__() -> Self {
Test { lines: Vec::new() }
}
fn add_line<'a>(slf: PyRefMut<'a, Self>, value: String, py: Python) -> PyResult<PyRefMut<'a, Self>> {
slf.lines.push(value);
Ok(slf)
}
} The |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I tried everything but couldn't get it done
(I am new to rust)
the result should be:
Is just an example to understand how it should work
Beta Was this translation helpful? Give feedback.
All reactions