mirror of
https://github.com/lennart-k/rustical.git
synced 2026-01-30 11:48:18 +00:00
make calendar object id extrinsic
This commit is contained in:
@@ -62,13 +62,12 @@ impl rustical_xml::ValueDeserialize for CalendarObjectType {
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct CalendarObject {
|
||||
id: String,
|
||||
inner: IcalCalendarObject,
|
||||
ics: String,
|
||||
}
|
||||
|
||||
impl CalendarObject {
|
||||
pub fn from_ics(ics: String, id: Option<String>) -> Result<Self, Error> {
|
||||
pub fn from_ics(ics: String) -> Result<Self, Error> {
|
||||
let mut parser: ComponentParser<_, IcalCalendarObject> =
|
||||
ComponentParser::new(ics.as_bytes());
|
||||
let inner = parser.next().ok_or(Error::MissingCalendar)??;
|
||||
@@ -78,11 +77,7 @@ impl CalendarObject {
|
||||
));
|
||||
}
|
||||
|
||||
Ok(Self {
|
||||
id: id.unwrap_or_else(|| inner.get_uid().to_owned()),
|
||||
inner,
|
||||
ics,
|
||||
})
|
||||
Ok(Self { inner, ics })
|
||||
}
|
||||
|
||||
#[must_use]
|
||||
@@ -95,11 +90,6 @@ impl CalendarObject {
|
||||
self.inner.get_uid()
|
||||
}
|
||||
|
||||
#[must_use]
|
||||
pub fn get_id(&self) -> &str {
|
||||
&self.id
|
||||
}
|
||||
|
||||
#[must_use]
|
||||
pub fn get_etag(&self) -> String {
|
||||
let mut hasher = Sha256::new();
|
||||
|
||||
Reference in New Issue
Block a user