new mqtt topic

This commit is contained in:
Robin Appelman 2021-03-23 20:08:18 +01:00
commit f0e28ed95c
3 changed files with 7 additions and 9 deletions

View file

@ -13,11 +13,10 @@ pub enum Topic {
impl From<&str> for Topic {
fn from(raw: &str) -> Self {
let mut parts = raw.split('/');
if let (Some(prefix), Some(topic), Some(hostname), Some(cmd)) =
(parts.next(), parts.next(), parts.next(), parts.next())
if let (Some(prefix), Some(hostname), Some(cmd)) =
(parts.next(), parts.next(), parts.next())
{
let device = Device {
topic: topic.to_string(),
hostname: hostname.to_string(),
};
match (prefix, cmd) {