pub type DeviceRoutes = Arc<dyn Fn(&Method, &str) -> Option<DeviceScope> + Send + Sync>;Expand description
The device scope a server’s own routes need, consulted after the kernel’s
device_scope_for: the server names its surface routes, so the
kernel never does. None closes a route to devices.
§Example
use std::sync::Arc;
use axum::http::Method;
use adk_kernel::pairing::{DeviceRoutes, DeviceScope};
let routes: DeviceRoutes = Arc::new(|method: &Method, path: &str| {
(method == Method::GET && path.starts_with("/api/surface/")).then_some(DeviceScope::Read)
});
assert_eq!(routes(&Method::GET, "/api/surface/status"), Some(DeviceScope::Read));Aliased Type§
pub struct DeviceRoutes { /* private fields */ }