summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Beyer <mail@beyermatthias.de>2019-12-27 14:07:12 +0100
committerMatthias Beyer <mail@beyermatthias.de>2019-12-27 14:07:12 +0100
commit91596ed83228d9aceb9e2fcec33a2131cc288fb3 (patch)
treecb2223624d8d1383e8058ba7753187ede0894280
parent8f8ef388e0dceabbb758f62f1f40fceef3873574 (diff)
Add IcalDuration::as_string()icaltime-as-string
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
-rw-r--r--src/duration.rs5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/duration.rs b/src/duration.rs
index 6de4c49..3e0adfd 100644
--- a/src/duration.rs
+++ b/src/duration.rs
@@ -25,6 +25,11 @@ impl IcalDuration {
pub fn to_seconds(&self) -> i32 {
unsafe { ical::icaldurationtype_as_int(self.duration) }
}
+
+ pub fn as_string(&self) -> String {
+ let cstr = unsafe { CStr::from_ptr(ical::icaldurationtype_as_ical_string(self.duration)) };
+ cstr.to_string_lossy().to_string()
+ }
}
impl Deref for IcalDuration {