summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFredrik Meringdal <fredrikmeringdal@Fredriks-MacBook-Pro.local>2021-02-07 14:49:23 +0100
committerFredrik Meringdal <fredrikmeringdal@Fredriks-MacBook-Pro.local>2021-02-07 14:49:23 +0100
commit99df6d05be64f7a4c621fd4b6518575dc842b37c (patch)
treefa4060191b82ad472ba8d2bd4b6c0bcc78a38ae9
parentec44420555eea3655adfa1db9d8b9846a29be176 (diff)
downloadrust_rrule-99df6d05be64f7a4c621fd4b6518575dc842b37c.zip
recatoring
-rw-r--r--src/iter/iterinfo.rs73
1 files changed, 21 insertions, 52 deletions
diff --git a/src/iter/iterinfo.rs b/src/iter/iterinfo.rs
index 048632b..b4d943b 100644
--- a/src/iter/iterinfo.rs
+++ b/src/iter/iterinfo.rs
@@ -49,88 +49,57 @@ impl IterInfo {
}
pub fn lastyear(&self) -> Option<isize> {
- match &self.monthinfo {
- Some(info) => Some(info.lastyear),
- None => None,
- }
+ self.monthinfo.as_ref().map(|info| info.lastyear)
}
pub fn lastmonth(&self) -> Option<usize> {
- match &self.monthinfo {
- Some(info) => Some(info.lastmonth),
- None => None,
- }
+ self.monthinfo.as_ref().map(|info| info.lastmonth)
}
+
pub fn yearlen(&self) -> Option<usize> {
- match &self.yearinfo {
- Some(info) => Some(info.yearlen),
- None => None,
- }
+ self.yearinfo.as_ref().map(|info| info.yearlen)
}
+
pub fn yearordinal(&self) -> Option<isize> {
- match &self.yearinfo {
- Some(info) => Some(info.yearordinal),
- None => None,
- }
+ self.yearinfo.as_ref().map(|info| info.yearordinal)
}
+
pub fn mrange(&self) -> Option<&Vec<usize>> {
- match &self.yearinfo {
- Some(info) => Some(&info.mrange),
- None => None,
- }
+ self.yearinfo.as_ref().map(|info| &info.mrange)
}
pub fn eastermask(&self) -> Option<&Vec<isize>> {
- match &self.eastermask {
- Some(mask) => Some(&mask),
- None => None,
- }
+ self.eastermask.as_ref()
}
+
pub fn wdaymask(&self) -> Option<&Vec<usize>> {
- match &self.yearinfo {
- Some(info) => Some(&info.wdaymask),
- None => None,
- }
+ self.yearinfo.as_ref().map(|info| &info.wdaymask)
}
pub fn mmask(&self) -> Option<&Vec<usize>> {
- match &self.yearinfo {
- Some(info) => Some(&info.mmask),
- None => None,
- }
+ self.yearinfo.as_ref().map(|info| &info.mmask)
}
pub fn wnomask(&self) -> Option<&Vec<usize>> {
match &self.yearinfo {
- Some(info) => match &info.wnomask {
- Some(mask) => Some(mask),
- None => None,
- },
+ Some(info) => info.wnomask.as_ref(),
None => None,
}
}
+
pub fn nwdaymask(&self) -> Option<&Vec<isize>> {
- match &self.monthinfo {
- Some(info) => Some(&info.nwdaymask),
- None => None,
- }
+ self.monthinfo.as_ref().map(|info| &info.nwdaymask)
}
+
pub fn nextyearlen(&self) -> Option<usize> {
- match &self.yearinfo {
- Some(info) => Some(info.nextyearlen),
- None => None,
- }
+ self.yearinfo.as_ref().map(|info| info.nextyearlen)
}
+
pub fn mdaymask(&self) -> Option<&Vec<isize>> {
- match &self.yearinfo {
- Some(info) => Some(&info.mdaymask),
- None => None,
- }
+ self.yearinfo.as_ref().map(|info| &info.mdaymask)
}
+
pub fn nmdaymask(&self) -> Option<&Vec<isize>> {
- match &self.yearinfo {
- Some(info) => Some(&info.nmdaymask),
- None => None,
- }
+ self.yearinfo.as_ref().map(|info| &info.nmdaymask)
}
pub fn ydayset(&self) -> (Vec<usize>, usize, usize) {