photon_runtime/runtime.rs
1//! Host-facing runtime wiring helpers (**Integrating the host**).
2
3use std::sync::Arc;
4
5use photon_backend::Result;
6
7use crate::{configure, Photon};
8
9/// Core runtime parts after builder (handler executor wired by integration layer).
10pub struct PhotonRuntimeParts {
11 /// Configured Photon handle.
12 pub photon: Arc<Photon>,
13}
14
15/// Build [`Photon`] with the default in-process `mem` storage adapter.
16///
17/// # Errors
18///
19/// Returns an error if the operation fails.
20pub fn build_photon_parts() -> Result<PhotonRuntimeParts> {
21 let photon = Photon::builder().auto_registry().build()?;
22
23 let photon = Arc::new(photon);
24 configure((*photon).clone());
25
26 Ok(PhotonRuntimeParts { photon })
27}