Skip to content

Instantly share code, notes, and snippets.

@jb55
Created September 1, 2018 17:57
Show Gist options
  • Save jb55/23cc11a3f47c57e04446777e0dc4ad35 to your computer and use it in GitHub Desktop.
Save jb55/23cc11a3f47c57e04446777e0dc4ad35 to your computer and use it in GitHub Desktop.
#[derive(Debug, Serialize, Deserialize)]
#[serde(untagged)]
pub enum LinkOr<T> {
Link(String),
NotLink(T)
}
#[derive(Debug, Serialize, Deserialize)]
#[serde(untagged)]
pub enum Range<T> {
RangeField(LinkOr<T>),
RangeValues(Vec<LinkOr<T>>)
}
#[derive(Debug, Serialize, Deserialize)]
pub struct Object {
// add to activity as well
id: Option<String>,
name: Option<String>,
#[serde(rename = "type")]
type_: String,
actor: Option<Range<Box<Object>>>,
object: Option<Range<Box<Object>>>,
summary: Option<String>,
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment