Expand description
Common re-exports for convenient access to core functionality
This module provides a single import point for all commonly used Ri components, simplifying application code and reducing the number of import statements.
§Usage
use ri::prelude::*;
#[tokio::main]
async fn main() -> RiResult<()> {
let app = RiAppBuilder::new()
.with_config("config.yaml")?
.build()?;
app.run(|ctx| async move {
ctx.logger().info("service", "Ri service started")?;
Ok(())
}).await
}Process-wide Tokio runtime shared by language bindings (PyO3 and any core
code that must drive async work from a synchronous context). Lazily
initialized on first use; see py_runtime module docs.
Global Tokio runtime shared by language bindings and sync-async bridges.
Python extension modules are loaded into whatever interpreter thread the
host application happens to be on; there is no guarantee that a Tokio
reactor is running (and Handle::current() panics when there is none).
The same holds for synchronous constructors and Drop implementations
in core code that need to drive async Ri APIs. This module provides a
lazily-initialized, process-wide multi-thread runtime for those cases.
Functions§
- py_
runtime - Returns the process-wide Tokio runtime used by PyO3 bindings.