From 6b9720844aaa86ad25a77c0821dcdbc772937065 Mon Sep 17 00:00:00 2001 From: Quentin Dufour Date: Sun, 26 May 2024 10:33:04 +0200 Subject: better support for time-range --- aero-dav/src/caldecoder.rs | 8 ++------ aero-dav/src/calencoder.rs | 12 ++++-------- 2 files changed, 6 insertions(+), 14 deletions(-) (limited to 'aero-dav') diff --git a/aero-dav/src/caldecoder.rs b/aero-dav/src/caldecoder.rs index 7de5e2a..b6a843f 100644 --- a/aero-dav/src/caldecoder.rs +++ b/aero-dav/src/caldecoder.rs @@ -917,15 +917,11 @@ impl QRead for TimeRange { xml.open(CAL_URN, "time-range").await?; let start = match xml.prev_attr("start") { - Some(r) => { - Some(NaiveDateTime::parse_from_str(r.as_str(), UTC_DATETIME_FMT)?.and_utc()) - } + Some(r) => Some(NaiveDateTime::parse_from_str(r.as_str(), UTC_DATETIME_FMT)?.and_utc()), _ => None, }; let end = match xml.prev_attr("end") { - Some(r) => { - Some(NaiveDateTime::parse_from_str(r.as_str(), UTC_DATETIME_FMT)?.and_utc()) - } + Some(r) => Some(NaiveDateTime::parse_from_str(r.as_str(), UTC_DATETIME_FMT)?.and_utc()), _ => None, }; diff --git a/aero-dav/src/calencoder.rs b/aero-dav/src/calencoder.rs index d5d4305..723d95d 100644 --- a/aero-dav/src/calencoder.rs +++ b/aero-dav/src/calencoder.rs @@ -739,19 +739,15 @@ impl QWrite for TimeRange { "start", format!("{}", start.format(UTC_DATETIME_FMT)).as_str(), )), - Self::OnlyEnd(end) => empty.push_attribute(( - "end", - format!("{}", end.format(UTC_DATETIME_FMT)).as_str(), - )), + Self::OnlyEnd(end) => { + empty.push_attribute(("end", format!("{}", end.format(UTC_DATETIME_FMT)).as_str())) + } Self::FullRange(start, end) => { empty.push_attribute(( "start", format!("{}", start.format(UTC_DATETIME_FMT)).as_str(), )); - empty.push_attribute(( - "end", - format!("{}", end.format(UTC_DATETIME_FMT)).as_str(), - )); + empty.push_attribute(("end", format!("{}", end.format(UTC_DATETIME_FMT)).as_str())); } } xml.q.write_event_async(Event::Empty(empty)).await -- cgit v1.2.3