data.rs 463 B

123456789101112131415161718
  1. use crate::{client::DocumentData, errors::OTError};
  2. use serde::{Deserialize, Serialize};
  3. impl<T: AsRef<str>> DocumentData for T {
  4. fn into_string(self) -> Result<String, OTError> { Ok(self.as_ref().to_string()) }
  5. }
  6. #[derive(Serialize, Deserialize, Debug)]
  7. pub struct ImageData {
  8. image: String,
  9. }
  10. impl DocumentData for ImageData {
  11. fn into_string(self) -> Result<String, OTError> {
  12. let s = serde_json::to_string(&self)?;
  13. Ok(s)
  14. }
  15. }