basyx_rs/
modelling_kind.rs

1// SPDX-FileCopyrightText: 2021 Fraunhofer Institute for Experimental Software Engineering IESE
2// SPDX-FileCopyrightText: 2023 Jan Hecht
3//
4// SPDX-License-Identifier: MIT
5
6use std::str::FromStr;
7
8use serde::{Deserialize, Serialize};
9
10#[derive(Clone, PartialEq, Debug, Deserialize, Serialize, Default)]
11pub enum ModellingKind {
12    #[default]
13    Instance,
14    Template,
15}
16
17impl FromStr for ModellingKind {
18    type Err = ();
19
20    fn from_str(s: &str) -> Result<Self, Self::Err> {
21        Ok(match s {
22            "Instance" => ModellingKind::Instance,
23            "Template" => ModellingKind::Template,
24            _ => return Err(()),
25        })
26    }
27}