|
@@ -4,7 +4,8 @@ use serde_json::Error;
|
|
|
use serde_repr::*;
|
|
|
|
|
|
pub trait GroupConfigurationContentSerde: Sized {
|
|
|
- fn from_configuration(s: &str) -> Result<Self, serde_json::Error>;
|
|
|
+ fn from_configuration_content(s: &str) -> Result<Self, serde_json::Error>;
|
|
|
+ fn to_configuration_content(&self) -> Result<String, serde_json::Error>;
|
|
|
}
|
|
|
|
|
|
#[derive(Debug, Clone, Serialize, Deserialize, Default, PartialEq, Eq)]
|
|
@@ -36,9 +37,12 @@ pub struct TextGroupConfigurationRevision {
|
|
|
}
|
|
|
|
|
|
impl GroupConfigurationContentSerde for TextGroupConfigurationRevision {
|
|
|
- fn from_configuration(s: &str) -> Result<Self, Error> {
|
|
|
+ fn from_configuration_content(s: &str) -> Result<Self, Error> {
|
|
|
serde_json::from_str(s)
|
|
|
}
|
|
|
+ fn to_configuration_content(&self) -> Result<String, Error> {
|
|
|
+ serde_json::to_string(self)
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
#[derive(Default, Serialize, Deserialize)]
|
|
@@ -47,9 +51,12 @@ pub struct NumberGroupConfigurationRevision {
|
|
|
}
|
|
|
|
|
|
impl GroupConfigurationContentSerde for NumberGroupConfigurationRevision {
|
|
|
- fn from_configuration(s: &str) -> Result<Self, Error> {
|
|
|
+ fn from_configuration_content(s: &str) -> Result<Self, Error> {
|
|
|
serde_json::from_str(s)
|
|
|
}
|
|
|
+ fn to_configuration_content(&self) -> Result<String, Error> {
|
|
|
+ serde_json::to_string(self)
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
#[derive(Default, Serialize, Deserialize)]
|
|
@@ -58,9 +65,12 @@ pub struct UrlGroupConfigurationRevision {
|
|
|
}
|
|
|
|
|
|
impl GroupConfigurationContentSerde for UrlGroupConfigurationRevision {
|
|
|
- fn from_configuration(s: &str) -> Result<Self, Error> {
|
|
|
+ fn from_configuration_content(s: &str) -> Result<Self, Error> {
|
|
|
serde_json::from_str(s)
|
|
|
}
|
|
|
+ fn to_configuration_content(&self) -> Result<String, Error> {
|
|
|
+ serde_json::to_string(self)
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
#[derive(Default, Serialize, Deserialize)]
|
|
@@ -69,9 +79,13 @@ pub struct CheckboxGroupConfigurationRevision {
|
|
|
}
|
|
|
|
|
|
impl GroupConfigurationContentSerde for CheckboxGroupConfigurationRevision {
|
|
|
- fn from_configuration(s: &str) -> Result<Self, Error> {
|
|
|
+ fn from_configuration_content(s: &str) -> Result<Self, Error> {
|
|
|
serde_json::from_str(s)
|
|
|
}
|
|
|
+
|
|
|
+ fn to_configuration_content(&self) -> Result<String, Error> {
|
|
|
+ serde_json::to_string(self)
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
#[derive(Default, Serialize, Deserialize)]
|
|
@@ -81,9 +95,13 @@ pub struct SelectOptionGroupConfigurationRevision {
|
|
|
}
|
|
|
|
|
|
impl GroupConfigurationContentSerde for SelectOptionGroupConfigurationRevision {
|
|
|
- fn from_configuration(s: &str) -> Result<Self, Error> {
|
|
|
+ fn from_configuration_content(s: &str) -> Result<Self, Error> {
|
|
|
serde_json::from_str(s)
|
|
|
}
|
|
|
+
|
|
|
+ fn to_configuration_content(&self) -> Result<String, Error> {
|
|
|
+ serde_json::to_string(self)
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
#[derive(Default, Serialize, Deserialize)]
|
|
@@ -102,9 +120,12 @@ pub struct DateGroupConfigurationRevision {
|
|
|
}
|
|
|
|
|
|
impl GroupConfigurationContentSerde for DateGroupConfigurationRevision {
|
|
|
- fn from_configuration(s: &str) -> Result<Self, Error> {
|
|
|
+ fn from_configuration_content(s: &str) -> Result<Self, Error> {
|
|
|
serde_json::from_str(s)
|
|
|
}
|
|
|
+ fn to_configuration_content(&self) -> Result<String, Error> {
|
|
|
+ serde_json::to_string(self)
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
#[derive(Serialize_repr, Deserialize_repr)]
|