Add constructors.

This commit is contained in:
James Pace 2026-08-14 14:00:46 -04:00
parent 893ab2f951
commit 294527085e
1 changed files with 22 additions and 0 deletions

View File

@ -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>,