summaryrefslogtreecommitdiffstats
path: root/src/icalwrap
diff options
context:
space:
mode:
authorNora <nora.widdecke@tu-bs.de>2019-01-19 01:14:57 +0100
committerNora <nora.widdecke@tu-bs.de>2019-01-19 02:09:33 +0100
commitaa42b59c2f8eaeedc17a1a559057d2ffa4ee9e87 (patch)
tree63ca817f4ac79d32112a798455b2010d084c1062 /src/icalwrap
parenteb81302a4539bcf2e10d2cc8dd1e0c25526cf7f2 (diff)
fileutil and khline: use io::Results
Diffstat (limited to 'src/icalwrap')
-rw-r--r--src/icalwrap/icalvcalendar.rs7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/icalwrap/icalvcalendar.rs b/src/icalwrap/icalvcalendar.rs
index 90811c0..b76e853 100644
--- a/src/icalwrap/icalvcalendar.rs
+++ b/src/icalwrap/icalvcalendar.rs
@@ -2,6 +2,7 @@ use chrono::{DateTime, Local};
use std::ffi::{CStr, CString};
use std::path::{PathBuf,Path};
use std::rc::Rc;
+use std::io;
use super::IcalVEvent;
use super::IcalComponent;
@@ -68,18 +69,18 @@ impl IcalVCalendar {
self
}
- pub fn from_str(str: &str, path: Option<&Path>) -> Result<Self, String> {
+ pub fn from_str(str: &str, path: Option<&Path>) -> io::Result<Self> {
unsafe {
let c_str = CString::new(str).unwrap();
let parsed_cal = ical::icalparser_parse_string(c_str.as_ptr());
if parsed_cal.is_null() {
- return Err("could not read component".to_string());
+ return Err(io::Error::new(io::ErrorKind::Other, "calendar has no path"))
}
let kind = ical::icalcomponent_isa(parsed_cal);
if kind != ical::icalcomponent_kind_ICAL_VCALENDAR_COMPONENT {
let kind = CStr::from_ptr(ical::icalcomponent_kind_to_string(kind)).to_string_lossy();
- return Err(format!("expected VCALENDAR component, got {}", kind));
+ return Err(io::Error::new(io::ErrorKind::Other, format!("expected VCALENDAR component, got {}", kind)))
}
let mut cal = IcalVCalendar::from_ptr(parsed_cal);