On 2026-03-10 13:08, Gabriel Goller wrote:
> Add a new serializer which uses only the builtin (include_str!) templates from
> the `proxmox-frr-templates` package in `/usr/share/proxmox-frr/templates` to
> generate the frr config file. Also update the `build_fabric` function and the
> tests accordingly.
> 
> Use the `phf` crate to store them in a const map.
> 
> Signed-off-by: Gabriel Goller <[email protected]>
> ---

[..]

>  #[derive(Error, Debug)]
>  pub enum FrrWordError {
>      #[error("word is empty")]
> @@ -113,7 +25,7 @@ pub enum FrrWordError {
>  ///
>  /// Every string argument or value in FRR is an FrrWord. FrrWords must only 
> contain ascii
>  /// characters and must not have a whitespace.
> -#[derive(Clone, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
> +#[derive(Clone, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, Serialize, 
> Deserialize)]

this would skip validation, we probably want something like
```
#[serde(try_from = "String")]
```
instead of the `Deserialize`

>  pub struct FrrWord(String);
>  
>  impl FrrWord {
> @@ -144,12 +56,6 @@ impl FromStr for FrrWord {
>      }
>  }
>  
> -impl Display for FrrWord {
> -    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
> -        self.0.fmt(f)
> -    }
> -}
> -
>  impl AsRef<str> for FrrWord {
>      fn as_ref(&self) -> &str {
>          &self.0
> @@ -157,7 +63,7 @@ impl AsRef<str> for FrrWord {
>  }
>  

[..]



Reply via email to