feat: implement IntoPyObject
for HomeAssistant
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
use std::convert::Infallible;
|
||||
|
||||
use pyo3::prelude::*;
|
||||
|
||||
use crate::python_utils::{detach, validate_type_by_name};
|
||||
@@ -17,6 +19,16 @@ impl<'source> FromPyObject<'source> for HomeAssistant {
|
||||
}
|
||||
}
|
||||
|
||||
impl<'py> IntoPyObject<'py> for &HomeAssistant {
|
||||
type Target = PyAny;
|
||||
type Output = Bound<'py, Self::Target>;
|
||||
type Error = Infallible;
|
||||
|
||||
fn into_pyobject(self, py: Python<'py>) -> Result<Self::Output, Self::Error> {
|
||||
Ok(self.0.bind(py).to_owned())
|
||||
}
|
||||
}
|
||||
|
||||
impl HomeAssistant {
|
||||
/// Return the representation
|
||||
pub fn repr(&self, py: Python<'_>) -> Result<String, PyErr> {
|
||||
|
Reference in New Issue
Block a user