use holochain_serialized_bytes::prelude::*;
#[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize, SerializedBytes)]
pub struct YamlProperties(serde_yaml::Value);
impl YamlProperties {
pub fn new(properties: serde_yaml::Value) -> Self {
Self(properties)
}
pub fn empty() -> Self {
Self(serde_yaml::Value::Null)
}
pub fn into_inner(self) -> serde_yaml::Value {
self.0
}
}
impl From<()> for YamlProperties {
fn from(_: ()) -> Self {
Self::empty()
}
}
impl From<serde_yaml::Value> for YamlProperties {
fn from(v: serde_yaml::Value) -> Self {
Self(v)
}
}
impl Default for YamlProperties {
fn default() -> Self {
Self::empty()
}
}
#[cfg(feature = "arbitrary")]
impl<'a> arbitrary::Arbitrary<'a> for YamlProperties {
fn arbitrary(_: &mut arbitrary::Unstructured<'a>) -> arbitrary::Result<Self> {
Ok(serde_yaml::Value::Null.into())
}
}