🚀 meta: initial commit

This commit is contained in:
2023-10-07 13:28:18 -04:00
commit fa36a86eab
7 changed files with 912 additions and 0 deletions

27
src/lib.rs Normal file
View File

@@ -0,0 +1,27 @@
use std::time::Duration;
use pyo3::prelude::*;
use tokio::time::interval;
async fn real_main() -> ! {
let duration = Duration::from_millis(400);
let mut interval = interval(duration);
loop {
let instant = interval.tick().await;
println!("it is now {instant:?}");
}
}
#[pyfunction]
fn main(py: Python) -> PyResult<&PyAny> {
pyo3_asyncio::tokio::future_into_py(py, async { Ok(real_main().await) })
}
/// A Python module implemented in Rust.
#[pymodule]
fn smart_home_in_rust_with_home_assistant(_py: Python, m: &PyModule) -> PyResult<()> {
m.add_function(wrap_pyfunction!(main, m)?)?;
Ok(())
}