Add constructors.
This commit is contained in:
parent
893ab2f951
commit
294527085e
22
src/lib.rs
22
src/lib.rs
|
|
@ -44,6 +44,14 @@ impl DiagnosticLevel {
|
|||
}
|
||||
}
|
||||
|
||||
#[pymethods]
|
||||
impl DiagnosticLevel {
|
||||
#[new]
|
||||
pub fn new() -> Self {
|
||||
Self::UNSET
|
||||
}
|
||||
}
|
||||
|
||||
#[pyclass]
|
||||
pub struct DiagnosticStatus {
|
||||
#[pyo3(get, set)]
|
||||
|
|
@ -58,6 +66,20 @@ pub struct DiagnosticStatus {
|
|||
values: Py<PyDict>,
|
||||
}
|
||||
|
||||
#[pymethods]
|
||||
impl DiagnosticStatus {
|
||||
#[new]
|
||||
pub fn new(py: Python<'_>) -> Self {
|
||||
Self {
|
||||
level: DiagnosticLevel::new(),
|
||||
name: PyString::new(py, "").unbind(),
|
||||
message: PyString::new(py, "").unbind(),
|
||||
hardware_id: PyString::new(py, "").unbind(),
|
||||
values: PyDict::new(py).unbind(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl DiagnosticStatus {
|
||||
fn from_rust<'py>(
|
||||
py: Python<'py>,
|
||||
|
|
|
|||
Loading…
Reference in New Issue