Make code more idomatic
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
This commit is contained in:
parent
8d0ae1058e
commit
ed469f622a
2 changed files with 15 additions and 23 deletions
|
@ -32,13 +32,9 @@ pub struct SetEndTimeIter<'a> {
|
|||
datetime: NDT,
|
||||
}
|
||||
|
||||
impl<'a> SetEndTimeIter<'a>
|
||||
{
|
||||
impl<'a> SetEndTimeIter<'a> {
|
||||
pub fn new(inner: CreateTimeTrackIter<'a>, datetime: NDT) -> SetEndTimeIter<'a> {
|
||||
SetEndTimeIter {
|
||||
inner: inner,
|
||||
datetime: datetime,
|
||||
}
|
||||
SetEndTimeIter { inner, datetime }
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -48,13 +44,11 @@ impl<'a> Iterator for SetEndTimeIter<'a> {
|
|||
fn next(&mut self) -> Option<Self::Item> {
|
||||
self.inner
|
||||
.next()
|
||||
.map(|res| {
|
||||
res.and_then(|mut fle| {
|
||||
let v = Value::String(self.datetime.format(DATE_TIME_FORMAT).to_string());
|
||||
let _ = fle.get_header_mut().insert(DATE_TIME_END_HEADER_PATH, v)?;
|
||||
Ok(fle)
|
||||
})
|
||||
})
|
||||
.map(|res| res.and_then(|mut fle| {
|
||||
let v = Value::String(self.datetime.format(DATE_TIME_FORMAT).to_string());
|
||||
let _ = fle.get_header_mut().insert(DATE_TIME_END_HEADER_PATH, v)?;
|
||||
Ok(fle)
|
||||
}))
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -57,16 +57,14 @@ impl Iterator for TagStoreIdIter {
|
|||
|
||||
self.inner
|
||||
.next()
|
||||
.map(|res| {
|
||||
res.and_then(|tag| {
|
||||
let dt = self.datetime.format(DATE_TIME_FORMAT).to_string();
|
||||
let id_str = format!("{}-{}", dt, tag.as_str());
|
||||
ModuleEntryPath::new(id_str)
|
||||
.into_storeid()
|
||||
.map_err(Error::from)
|
||||
.map(|id| (id, self.datetime.clone()))
|
||||
})
|
||||
})
|
||||
.map(|res| res.and_then(|tag| {
|
||||
let dt = self.datetime.format(DATE_TIME_FORMAT).to_string();
|
||||
let id_str = format!("{}-{}", dt, tag.as_str());
|
||||
ModuleEntryPath::new(id_str)
|
||||
.into_storeid()
|
||||
.map_err(Error::from)
|
||||
.map(|id| (id, self.datetime.clone()))
|
||||
}))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue