summaryrefslogtreecommitdiff
path: root/crdt/src/doc.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crdt/src/doc.rs')
-rw-r--r--crdt/src/doc.rs15
1 files changed, 14 insertions, 1 deletions
diff --git a/crdt/src/doc.rs b/crdt/src/doc.rs
index bbd24d0..fcca1d8 100644
--- a/crdt/src/doc.rs
+++ b/crdt/src/doc.rs
@@ -1,3 +1,4 @@
+use serde::{Deserialize, Serialize};
use thiserror::Error;
use uuid::Uuid;
@@ -41,21 +42,33 @@ impl DerivableId for DerivedId {
}
}
-#[derive(Default)]
+impl Serialize for DerivedId {
+ fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
+ where
+ S: serde::Serializer,
+ {
+ serializer.serialize_str(&self.to_string())
+ }
+}
+
+#[derive(Default, Serialize)]
pub struct Doc {
pub(crate) grids: Vec<Grid>,
}
+#[derive(Serialize)]
pub struct Grid {
pub(crate) id: DerivedId,
pub(crate) rows: Vec<Row>,
}
+#[derive(Serialize)]
pub struct Row {
pub(crate) id: DerivedId,
pub(crate) cells: Vec<Cell>,
}
+#[derive(Serialize)]
pub struct Cell {
pub(crate) id: DerivedId,
}