use crate::device::{DeviceId, DeviceService, ServerUtilitiesHandle};
#[derive(Debug)]
pub struct CallError;
#[derive(new, Clone, Debug)]
pub struct ServiceCreationError {
#[allow(dead_code)] reason: alloc::string::String,
}
pub(crate) trait DeviceHandleSpec<S: DeviceService>: Sized {
const BLOCKING: bool;
fn insert(device_id: DeviceId, service: S) -> Result<Self, ServiceCreationError>;
fn new(device_id: DeviceId) -> Self;
fn device_id(&self) -> DeviceId;
fn utilities(&self) -> ServerUtilitiesHandle;
fn flush_queue(&self);
fn submit_blocking<'a, R: Send, T: FnOnce(&mut S) -> R + Send + 'a>(
&self,
task: T,
) -> Result<R, CallError>;
fn submit<T: FnOnce(&mut S) + Send + 'static>(&self, task: T);
fn exclusive<R: Send, T: FnOnce() -> R + Send>(&self, task: T) -> Result<R, CallError>;
}