mirror of
https://gitlab.com/fabinfra/fabaccess/bffh.git
synced 2025-06-11 10:53:19 +02:00
prodable machines
This commit is contained in:
@ -59,6 +59,16 @@ pub struct MachineDescription {
|
||||
/// The permission required
|
||||
#[serde(flatten)]
|
||||
pub privs: PrivilegesBuf,
|
||||
|
||||
#[serde(default = "default_prodable", skip_serializing_if = "bool_is_false", deserialize_with = "deser_bool")]
|
||||
pub prodable: bool,
|
||||
}
|
||||
|
||||
fn default_prodable() -> bool {
|
||||
false
|
||||
}
|
||||
fn bool_is_false(b: &bool) -> bool {
|
||||
!b
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
@ -116,6 +126,14 @@ pub struct ModuleConfig {
|
||||
pub params: HashMap<String, String>,
|
||||
}
|
||||
|
||||
fn deser_bool<'de, D>(d: D) -> Result<bool, D::Error>
|
||||
where
|
||||
D: serde::Deserializer<'de>,
|
||||
{
|
||||
Ok(bool::deserialize(d).unwrap_or(false))
|
||||
}
|
||||
|
||||
|
||||
pub(crate) fn deser_option<'de, D, T>(d: D) -> std::result::Result<Option<T>, D::Error>
|
||||
where
|
||||
D: serde::Deserializer<'de>,
|
||||
|
Reference in New Issue
Block a user