Skip to content

Instantly share code, notes, and snippets.

@mfpiccolo
Created January 18, 2016 02:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mfpiccolo/694050a61796dbd5ced1 to your computer and use it in GitHub Desktop.
Save mfpiccolo/694050a61796dbd5ced1 to your computer and use it in GitHub Desktop.
impl<T, U> ToJsonApi for Vec<(T, Option<U>)>
where T: ToResourceObject + Default, U: ToResourceObject
{
fn serialize(&self) -> String {
self.into_iter().group_by(|&&(a, b)| a)
.map(|(c, d)| d.into_iter().filter_map(|(e,f)| f).collect())
.collect();
"some".to_string()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment