pub enum SparkplugTopic {
Node {
group: GroupId,
edge: EdgeNodeId,
ty: MessageType,
},
Device {
group: GroupId,
edge: EdgeNodeId,
device: DeviceId,
ty: MessageType,
},
HostState {
host_id: String,
},
}Expand description
A parsed Sparkplug B topic.
Variants§
Node
An Edge-Node-level topic (4 tokens; N* message types).
Fields
edge: EdgeNodeIdEdge Node ID.
ty: MessageTypeMessage type (one of NBIRTH/NDEATH/NDATA/NCMD).
Device
A Device-level topic (5 tokens; D* message types).
Fields
edge: EdgeNodeIdEdge Node ID.
ty: MessageTypeMessage type (one of DBIRTH/DDEATH/DDATA/DCMD).
HostState
A Host Application STATE topic (spBv1.0/STATE/<host_id>).
Implementations§
Source§impl SparkplugTopic
impl SparkplugTopic
Sourcepub fn node(group: GroupId, edge: EdgeNodeId, ty: MessageType) -> Result<Self>
pub fn node(group: GroupId, edge: EdgeNodeId, ty: MessageType) -> Result<Self>
Build an Edge-Node topic; the message type must be a non-device N* type.
§Errors
Returns SparkplugError::InvalidTopic if ty is a device or STATE type.
Sourcepub fn device(
group: GroupId,
edge: EdgeNodeId,
device: DeviceId,
ty: MessageType,
) -> Result<Self>
pub fn device( group: GroupId, edge: EdgeNodeId, device: DeviceId, ty: MessageType, ) -> Result<Self>
Build a Device topic; the message type must be a D* type.
§Errors
Returns SparkplugError::InvalidTopic if ty is not a device type.
Sourcepub fn message_type(&self) -> MessageType
pub fn message_type(&self) -> MessageType
The message type of this topic.
Sourcepub fn parse(topic: &str) -> Result<Self>
pub fn parse(topic: &str) -> Result<Self>
Parse a topic string into a validated SparkplugTopic.
§Errors
Returns SparkplugError::InvalidTopic / SparkplugError::InvalidId
for a bad namespace, wrong token count, reserved characters, or a
message type that does not match the topic arity.
Trait Implementations§
Source§impl Clone for SparkplugTopic
impl Clone for SparkplugTopic
Source§fn clone(&self) -> SparkplugTopic
fn clone(&self) -> SparkplugTopic
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for SparkplugTopic
impl Debug for SparkplugTopic
Source§impl Display for SparkplugTopic
impl Display for SparkplugTopic
impl Eq for SparkplugTopic
Source§impl PartialEq for SparkplugTopic
impl PartialEq for SparkplugTopic
Source§fn eq(&self, other: &SparkplugTopic) -> bool
fn eq(&self, other: &SparkplugTopic) -> bool
self and other values to be equal, and is used by ==.