SHARE
TWEET

Untitled

a guest Sep 22nd, 2019 88 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. use serde::ser::{Serialize, Serializer, SerializeStruct};
  2.  
  3. #[derive(Debug)]
  4. struct Term {
  5.     name: String,
  6.     value: String
  7. }
  8.  
  9. impl Serialize for Term {
  10.     fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
  11.     where
  12.         S: Serializer,
  13.     {
  14.         let mut state = serializer.serialize_struct("Term", 1)?;
  15.         state.serialize_field("name", &self.name)?;
  16.         state.end()
  17.     }
  18. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top