Trait Service
pub trait Service {
const ID: u32;
const VERSION: u8;
}Expand description
A QMI service, implemented by a marker type.
A service crate defines a zero-sized marker for its service and sets it as
the Service of its requests and
indications. Client<S> only sends requests of service
S. ServiceWatcher::wait_for_service
waits for the service.
§Example
use ql_qmi::{ClientBuilder, Service};
/// Quectel common service.
#[derive(Clone, Copy, Debug)]
pub struct Quec;
impl Service for Quec {
const ID: u32 = 0xE3;
const VERSION: u8 = 1;
}
/// Client of the Quectel common service.
#[derive(Clone, Debug)]
pub struct Client {
qmi: ql_qmi::Client<Quec>,
}
impl Client {
/// Returns a builder for the client.
pub const fn builder() -> ClientBuilder<Quec, Self> {
ClientBuilder::new()
}
}
impl From<ql_qmi::Client<Quec>> for Client {
fn from(qmi: ql_qmi::Client<Quec>) -> Self {
Self { qmi }
}
}Required Associated Constants§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".