From f4064c19ec140987e15c64e80a3bf0c70025b31b Mon Sep 17 00:00:00 2001 From: Bryan Newbold Date: Sat, 30 Jun 2018 17:34:22 -0700 Subject: history for container entities --- rust/fatcat-api/src/models.rs | 69 +++---------------------------------------- 1 file changed, 4 insertions(+), 65 deletions(-) (limited to 'rust/fatcat-api/src/models.rs') diff --git a/rust/fatcat-api/src/models.rs b/rust/fatcat-api/src/models.rs index 7ff39789..f33ed9db 100644 --- a/rust/fatcat-api/src/models.rs +++ b/rust/fatcat-api/src/models.rs @@ -275,68 +275,7 @@ impl EntityEdit { } #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] -pub struct EntityHistory(Vec); - -impl ::std::convert::From> for EntityHistory { - fn from(x: Vec) -> Self { - EntityHistory(x) - } -} - -impl ::std::convert::From for Vec { - fn from(x: EntityHistory) -> Self { - x.0 - } -} - -impl ::std::iter::FromIterator for EntityHistory { - fn from_iter>(u: U) -> Self { - EntityHistory(Vec::::from_iter(u)) - } -} - -impl ::std::iter::IntoIterator for EntityHistory { - type Item = EntityHistoryInner; - type IntoIter = ::std::vec::IntoIter; - - fn into_iter(self) -> Self::IntoIter { - self.0.into_iter() - } -} - -impl<'a> ::std::iter::IntoIterator for &'a EntityHistory { - type Item = &'a EntityHistoryInner; - type IntoIter = ::std::slice::Iter<'a, EntityHistoryInner>; - - fn into_iter(self) -> Self::IntoIter { - (&self.0).into_iter() - } -} - -impl<'a> ::std::iter::IntoIterator for &'a mut EntityHistory { - type Item = &'a mut EntityHistoryInner; - type IntoIter = ::std::slice::IterMut<'a, EntityHistoryInner>; - - fn into_iter(self) -> Self::IntoIter { - (&mut self.0).into_iter() - } -} - -impl ::std::ops::Deref for EntityHistory { - type Target = Vec; - fn deref(&self) -> &Self::Target { - &self.0 - } -} - -impl ::std::ops::DerefMut for EntityHistory { - fn deref_mut(&mut self) -> &mut Self::Target { - &mut self.0 - } -} - -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] -pub struct EntityHistoryInner { +pub struct EntityHistoryEntry { #[serde(rename = "edit")] pub edit: models::EntityEdit, @@ -347,9 +286,9 @@ pub struct EntityHistoryInner { pub changelog: models::ChangelogEntry, } -impl EntityHistoryInner { - pub fn new(edit: models::EntityEdit, editgroup: models::Editgroup, changelog: models::ChangelogEntry) -> EntityHistoryInner { - EntityHistoryInner { +impl EntityHistoryEntry { + pub fn new(edit: models::EntityEdit, editgroup: models::Editgroup, changelog: models::ChangelogEntry) -> EntityHistoryEntry { + EntityHistoryEntry { edit: edit, editgroup: editgroup, changelog: changelog, -- cgit v1.2.3