Serialize a list of conflicts to bytes (JSON). Conflict metadata is tiny and rare, so JSON via `serde_json` (already a dependency) is preferred over a hand-rolled binary format for robustness.
(conflicts: &[StoredConflict])
| 18 | /// Conflict metadata is tiny and rare, so JSON via `serde_json` (already a |
| 19 | /// dependency) is preferred over a hand-rolled binary format for robustness. |
| 20 | pub fn serialize_conflicts(conflicts: &[StoredConflict]) -> PristineResult<Vec<u8>> { |
| 21 | serde_json::to_vec(conflicts).map_err(|e| PristineError::Serialization { |
| 22 | message: format!("failed to serialize conflicts: {e}"), |
| 23 | }) |
| 24 | } |
| 25 | |
| 26 | /// Deserialize bytes (JSON) to a list of conflicts. |
| 27 | pub fn deserialize_conflicts(bytes: &[u8]) -> PristineResult<Vec<StoredConflict>> { |