use std::{path::PathBuf, str::FromStr};
use crate::{bail, prelude::ErrorKind, zfresult::ZFError};
pub mod descriptor;
pub mod record;
pub mod registry;
#[derive(Debug)]
pub(crate) enum Middleware {
Zenoh,
}
impl FromStr for Middleware {
type Err = ZFError;
fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
let s = s.to_lowercase();
if s == "zenoh" {
return Ok(Self::Zenoh);
}
bail!(
ErrorKind::ParsingError,
"Unsupported middleware: '{s}'. Currently supported middlewares: 'zenoh'."
)
}
}
impl ToString for Middleware {
fn to_string(&self) -> String {
"zenoh".to_string()
}
}
#[derive(Debug)]
pub(crate) enum ZFUri {
File(PathBuf),
Builtin(Middleware),
}