Expand description
This module defines types and interfaces that internal clients use to interact with the core of DrMem. The primary, internal client is the GraphQL interface.
Any new, internal tasks that need access to device readings or
wish to set the value of the device need to have a
client::RequestChan
handle. As DrMem starts, it should
.clone()
the RequestChan
used to communicate with the
back-end.
Example
ⓘ
async fn some_new_task(handle: client::RequestChan) {
// Initialize and enter loop.
let device = "some:device".parse::<device::Name>().unwrap();
loop {
// Set a device value.
if some_condition {
handle.set_device(&device, true.into())
}
}
}
// Somewhere in DrMem start-up.
let task = some_new_task(backend_chan.clone());
// Add the task to the set of tasks to be awaited.
Structs
- Holds information about a device. A back-end is free to store this information in any way it sees fit. However, it is returned for GraphQL queries, so it should be reasonably efficient to assemble this reply.
- A handle which is used to communicate with the core of DrMem. Clients will be given a handle to be used throughout its life.