pub struct AppState {
pub devices: Arc<DeviceRegistry>,
}Expand description
Shared application state, cheaply cloned into every route handler via Axum’s
State extractor. Holds only the device registry; all per-device state
lives behind DeviceRegistry.
Fields§
§devices: Arc<DeviceRegistry>Implementations§
Source§impl AppState
impl AppState
Sourcepub fn new() -> Self
pub fn new() -> Self
Empty registry with the default no-op StandardCsiProfile; populate
via DeviceRegistry::attach or crate::supervisor::run_supervisor.
Sourcepub fn with_profile(profile: Arc<dyn CsiProfile>) -> Self
pub fn with_profile(profile: Arc<dyn CsiProfile>) -> Self
Empty registry whose devices carry a custom capability CsiProfile.
An embedder supplies its own profile to extend the accepted protocols,
CSI presets, and data_format labels.
Sourcepub fn profile(&self) -> &Arc<dyn CsiProfile>
pub fn profile(&self) -> &Arc<dyn CsiProfile>
The capability profile shared by this state’s devices.
Trait Implementations§
Source§impl FromRequestParts<AppState> for Device
impl FromRequestParts<AppState> for Device
Source§type Rejection = (StatusCode, Json<ApiResponse>)
type Rejection = (StatusCode, Json<ApiResponse>)
If the extractor fails it’ll use this “rejection” type. A rejection is
a kind of error that can be converted into a response.
Auto Trait Implementations§
impl !RefUnwindSafe for AppState
impl !UnwindSafe for AppState
impl Freeze for AppState
impl Send for AppState
impl Sync for AppState
impl Unpin for AppState
impl UnsafeUnpin for AppState
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more