2020-02-08 18:50:55 +00:00
|
|
|
use pyo3::prelude::*;
|
|
|
|
|
|
|
|
#[pyclass]
|
|
|
|
struct ClassWithGetter {}
|
|
|
|
|
|
|
|
#[pymethods]
|
|
|
|
impl ClassWithGetter {
|
|
|
|
#[getter]
|
2024-05-03 07:42:30 +00:00
|
|
|
fn getter_with_arg(&self, _py: Python<'_>, _index: u32) {}
|
2020-02-08 18:50:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#[pyclass]
|
|
|
|
struct ClassWithSetter {}
|
|
|
|
|
|
|
|
#[pymethods]
|
|
|
|
impl ClassWithSetter {
|
|
|
|
#[setter]
|
2024-05-03 07:42:30 +00:00
|
|
|
fn setter_with_no_arg(&mut self, _py: Python<'_>) {}
|
2020-02-08 18:50:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#[pymethods]
|
|
|
|
impl ClassWithSetter {
|
|
|
|
#[setter]
|
2024-05-03 07:42:30 +00:00
|
|
|
fn setter_with_too_many_args(&mut self, _py: Python<'_>, _foo: u32, _bar: u32) {}
|
2020-02-08 18:50:55 +00:00
|
|
|
}
|
|
|
|
|
2021-03-18 10:27:18 +00:00
|
|
|
#[pyclass]
|
2021-06-04 10:16:25 +00:00
|
|
|
struct TupleGetterSetterNoName(#[pyo3(get, set)] i32);
|
|
|
|
|
|
|
|
#[pyclass]
|
|
|
|
struct MultipleGet(#[pyo3(get, get)] i32);
|
|
|
|
|
|
|
|
#[pyclass]
|
|
|
|
struct MultipleSet(#[pyo3(set, set)] i32);
|
|
|
|
|
|
|
|
#[pyclass]
|
|
|
|
struct MultipleName(#[pyo3(name = "foo", name = "bar")] i32);
|
|
|
|
|
|
|
|
#[pyclass]
|
|
|
|
struct NameWithoutGetSet(#[pyo3(name = "value")] i32);
|
2021-03-18 10:27:18 +00:00
|
|
|
|
2020-02-08 18:50:55 +00:00
|
|
|
fn main() {}
|