From cd1c566c8a68b097235e57267b8106ceee150e2a Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Wed, 8 Apr 2020 22:44:04 -0400 Subject: error: remove the Result type alias Instead, make a local type alias that can be used within the crate, but avoid the need to export yet another symbol. --- src/icalendar.rs | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) (limited to 'src/icalendar.rs') diff --git a/src/icalendar.rs b/src/icalendar.rs index c49e193..4863029 100644 --- a/src/icalendar.rs +++ b/src/icalendar.rs @@ -1,4 +1,3 @@ -use std::result::Result as RResult; use std::collections::BTreeMap; use component::Component; @@ -23,7 +22,7 @@ impl ICalendar { /// Returns an error if the parsed text is not a ICalendar (that means that an error is /// returned also if this is a valid Vcard!) /// - pub fn build(s: &str) -> Result { + pub fn build(s: &str) -> VObjectResult { let c = parse_component(s)?; Self::from_component(c).map_err(|_| VObjectErrorKind::NotAnICalendar(s.to_owned())) } @@ -45,7 +44,7 @@ impl ICalendar { } /// Wrap a Component into a Vcard object, or don't do it if the Component is not a Vcard. - pub fn from_component(c: Component)-> RResult { + pub fn from_component(c: Component)-> Result { if c.name == "VCALENDAR" { Ok(ICalendar(c)) } else { @@ -99,7 +98,7 @@ impl<'a> EventIterator<'a> { } impl<'a> Iterator for EventIterator<'a> { - type Item = RResult, &'a Component>; + type Item = Result, &'a Component>; fn next(&mut self) -> Option { self.0.next().map(Event::from_component) @@ -111,7 +110,7 @@ impl<'a> Iterator for EventIterator<'a> { pub struct Event<'a>(&'a Component); impl<'a> Event<'a> { - fn from_component(c: &'a Component) -> RResult, &'a Component> { + fn from_component(c: &'a Component) -> Result, &'a Component> { if c.name == "VEVENT" { Ok(Event(c)) } else { @@ -160,13 +159,13 @@ pub enum Time { #[cfg(feature = "timeconversions")] pub trait AsDateTime { - fn as_datetime(&self) -> Result