adding constructor and get/set
This commit is contained in:
parent
fbc5b099d6
commit
debf43dff9
@ -2,9 +2,18 @@ use pyo3::prelude::*;
|
||||
|
||||
#[pyclass]
|
||||
pub struct Integer {
|
||||
#[pyo3(get, set)]
|
||||
inner: i32,
|
||||
}
|
||||
|
||||
#[pymethods]
|
||||
impl Integer {
|
||||
#[new]
|
||||
fn new(value: i32) -> Integer {
|
||||
Integer { inner: value }
|
||||
}
|
||||
}
|
||||
|
||||
// A "tuple" struct
|
||||
#[pyclass]
|
||||
pub struct Number(i32);
|
||||
|
Loading…
Reference in New Issue
Block a user