pub struct Device<'d, T: Transport> { /* private fields */ }Expand description
The untyped runtime facade over one device profile. Generated typed
clients (moddef-codegen) skip this and use static descriptor tables.
Implementations§
Source§impl<'d, T: Transport> Device<'d, T>
impl<'d, T: Transport> Device<'d, T>
Sourcepub fn new(
doc: &'d ModDefDocument,
device_id: Option<&str>,
transport: T,
) -> Result<Self, Error<T::Error>>
pub fn new( doc: &'d ModDefDocument, device_id: Option<&str>, transport: T, ) -> Result<Self, Error<T::Error>>
Bind a transport to the named device profile in doc (or the only one).
pub fn from_profile(profile: &'d DeviceProfile, transport: T) -> Self
pub fn profile(&self) -> &'d DeviceProfile
pub fn transport_mut(&mut self) -> &mut T
pub fn into_transport(self) -> T
Sourcepub fn points(&self) -> impl Iterator<Item = &'d Point>
pub fn points(&self) -> impl Iterator<Item = &'d Point>
All points in block order (spec §32.1).
Sourcepub fn point(
&self,
id: &str,
) -> Result<(&'d Point, &'d RegisterBlock), Error<T::Error>>
pub fn point( &self, id: &str, ) -> Result<(&'d Point, &'d RegisterBlock), Error<T::Error>>
Look up a point and its owning block by id.
Sourcepub async fn read_point(
&mut self,
id: &str,
) -> Result<DecodedValue, Error<T::Error>>
pub async fn read_point( &mut self, id: &str, ) -> Result<DecodedValue, Error<T::Error>>
Read and decode a single point by id.
Sourcepub async fn read_measurand(
&mut self,
q: &MeasurandQuery<'_>,
) -> Result<DecodedValue, Error<T::Error>>
pub async fn read_measurand( &mut self, q: &MeasurandQuery<'_>, ) -> Result<DecodedValue, Error<T::Error>>
Read a point by its semantic measurand tuple (spec §26.1).
Auto Trait Implementations§
impl<'d, T> Freeze for Device<'d, T>where
T: Freeze,
impl<'d, T> RefUnwindSafe for Device<'d, T>where
T: RefUnwindSafe,
impl<'d, T> Send for Device<'d, T>where
T: Send,
impl<'d, T> Sync for Device<'d, T>where
T: Sync,
impl<'d, T> Unpin for Device<'d, T>where
T: Unpin,
impl<'d, T> UnsafeUnpin for Device<'d, T>where
T: UnsafeUnpin,
impl<'d, T> UnwindSafe for Device<'d, T>where
T: UnwindSafe,
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