2020-02-08 18:50:55 +00:00
|
|
|
use pyo3::prelude::*;
|
|
|
|
|
|
|
|
#[pyclass]
|
|
|
|
struct ClassWithGetter {}
|
|
|
|
|
|
|
|
#[pymethods]
|
|
|
|
impl ClassWithGetter {
|
|
|
|
#[getter]
|
|
|
|
fn getter_with_arg(&self, py: Python, index: u32) {}
|
|
|
|
}
|
|
|
|
|
|
|
|
#[pyclass]
|
|
|
|
struct ClassWithSetter {}
|
|
|
|
|
|
|
|
#[pymethods]
|
|
|
|
impl ClassWithSetter {
|
|
|
|
#[setter]
|
|
|
|
fn setter_with_no_arg(&mut self, py: Python) {}
|
|
|
|
}
|
|
|
|
|
|
|
|
#[pymethods]
|
|
|
|
impl ClassWithSetter {
|
|
|
|
#[setter]
|
|
|
|
fn setter_with_too_many_args(&mut self, py: Python, foo: u32, bar: u32) {}
|
|
|
|
}
|
|
|
|
|
2021-03-18 10:27:18 +00:00
|
|
|
#[pyclass]
|
|
|
|
struct TupleGetterSetter(#[pyo3(get, set)] i32);
|
|
|
|
|
2020-02-08 18:50:55 +00:00
|
|
|
fn main() {}
|