pub struct BindContext<'a> { /* private fields */ }Expand description
Handed to a sensor during binding so it can declare what it will observe.
Sensors may declare entities of their own, not only channels. A thermal zone and a RAPL power domain are real parts of the machine that the CPU topology knows nothing about, and forcing them to be attributes of a core would be exactly the human-ontology imposition this architecture avoids.
Implementations§
Source§impl<'a> BindContext<'a>
impl<'a> BindContext<'a>
pub fn new( substrate: &'a Substrate, sensor: SensorId, entities: &'a mut Vec<Entity>, channels: &'a mut Vec<ChannelSpec>, relations: &'a mut Vec<Relation>, ) -> BindContext<'a>
Sourcepub fn substrate(&self) -> &Substrate
pub fn substrate(&self) -> &Substrate
The structural machine description, including filesystem roots.
Sourcepub fn row_of(&self, key: &str) -> Option<u32>
pub fn row_of(&self, key: &str) -> Option<u32>
Row index of an already-declared entity, by natural key.
Sourcepub fn declare_entity(&mut self, entity: Entity) -> u32
pub fn declare_entity(&mut self, entity: Entity) -> u32
Declare an entity, or return the existing row if its key is already present. Idempotent, so two sensors observing the same physical thing agree about which row it is rather than duplicating it.
Sourcepub fn declare_channel(
&mut self,
key: impl Into<String>,
unit: Unit,
semantics: Semantics,
) -> ChannelId
pub fn declare_channel( &mut self, key: impl Into<String>, unit: Unit, semantics: Semantics, ) -> ChannelId
Declare a channel and get its column index.
Sourcepub fn declare_relation(&mut self, relation: Relation)
pub fn declare_relation(&mut self, relation: Relation)
Declare an edge.
Auto Trait Implementations§
impl<'a> !UnwindSafe for BindContext<'a>
impl<'a> Freeze for BindContext<'a>
impl<'a> RefUnwindSafe for BindContext<'a>
impl<'a> Send for BindContext<'a>
impl<'a> Sync for BindContext<'a>
impl<'a> Unpin for BindContext<'a>
impl<'a> UnsafeUnpin for BindContext<'a>
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