pub struct AliasRegistry { /* private fields */ }Expand description
Bidirectional name↔alias bindings plus a datatype index, scoped to one Edge Node or Device.
Implementations§
Source§impl AliasRegistry
impl AliasRegistry
Sourcepub fn bind(&mut self, name: &str, alias: Option<u64>, datatype: DataType)
pub fn bind(&mut self, name: &str, alias: Option<u64>, datatype: DataType)
Bind a metric’s name (and optional alias) to its datatype, as declared in
a BIRTH. Overwrites any existing binding for the same name/alias; use
AliasRegistry::try_bind to enforce the duplicate-alias-is-fatal rule.
Sourcepub fn try_bind(
&mut self,
name: &str,
alias: Option<u64>,
datatype: DataType,
) -> Result<()>
pub fn try_bind( &mut self, name: &str, alias: Option<u64>, datatype: DataType, ) -> Result<()>
Like AliasRegistry::bind, but rejects an alias already bound to a
different name — a duplicate alias in a BIRTH is fatal per the spec.
§Errors
Returns SparkplugError::InvalidId if alias is already bound to a
different metric name.
Sourcepub fn datatype_for_name(&self, name: &str) -> Option<DataType>
pub fn datatype_for_name(&self, name: &str) -> Option<DataType>
The datatype declared for name, if any.
Sourcepub fn datatype_for_alias(&self, alias: u64) -> Option<DataType>
pub fn datatype_for_alias(&self, alias: u64) -> Option<DataType>
The datatype declared for alias, if any.
Sourcepub fn name_for_alias(&self, alias: u64) -> Option<&str>
pub fn name_for_alias(&self, alias: u64) -> Option<&str>
The name bound to alias, if any.
Sourcepub fn alias_for_name(&self, name: &str) -> Option<u64>
pub fn alias_for_name(&self, name: &str) -> Option<u64>
The alias bound to name, if any.
Sourcepub fn alias_exists(&self, alias: u64) -> bool
pub fn alias_exists(&self, alias: u64) -> bool
Whether alias is already bound (to detect duplicate aliases in a birth).
Trait Implementations§
Source§impl Clone for AliasRegistry
impl Clone for AliasRegistry
Source§fn clone(&self) -> AliasRegistry
fn clone(&self) -> AliasRegistry
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for AliasRegistry
impl Debug for AliasRegistry
Source§impl Default for AliasRegistry
impl Default for AliasRegistry
Source§fn default() -> AliasRegistry
fn default() -> AliasRegistry
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for AliasRegistry
impl RefUnwindSafe for AliasRegistry
impl Send for AliasRegistry
impl Sync for AliasRegistry
impl Unpin for AliasRegistry
impl UnsafeUnpin for AliasRegistry
impl UnwindSafe for AliasRegistry
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