async fn resolve(&self) -> CalDavResult<IcalEvent> {
        let borrow = self.data.borrow();
        match &*borrow {
            EventPointerData::FetchedEvent(event) => Ok(event.clone()),
            EventPointerData::CreatedEventResponse { uid } => {
                let body_string = xml! {
                    <?xml version="1.0" encoding="utf-8" ?>
                    <C:calendar-query xmlns:C="urn:ietf:params:xml:ns:caldav">
                      <D:prop xmlns:D="DAV:">
                        <D:getetag/>
                        <C:calendar-data/>
                      </D:prop>
                      <C:filter>
                        <C:comp-filter name="VCALENDAR">
                          <C:comp-filter name="VEVENT">
                            <C:prop-filter name="UID">
                              <C:text-match collation="i;octet"
                              >{uid}</C:text-match>
                            </C:prop-filter>
                          </C:comp-filter>
                        </C:comp-filter>
                      </C:filter>
                    </C:calendar-query>
                }
                .to_string();
                let res = self
                    .client
                    .request(Method::from_bytes(REPORT).unwrap(), self.url.as_str())
                    .await?
                    .header("Content-Type", "application/xml; charset=\"utf-8\"")
                    .body(body_string)
                    .send()
                    .await?;
                let document = res.text().await.unwrap();
                let document = Document::parse(&document).unwrap();
                let event = get_calendar_data(document.descendants())
                    .map(|e| e.events)
                    .flatten()
                    .next()
                    .map(Ok)
                    .unwrap_or(Err(CalDavError::OtherError))?;
                std::mem::drop(borrow);
                let mut d = self.data.borrow_mut();
                *d = EventPointerData::FetchedEvent(event.clone());
                std::mem::drop(d);
                Ok(event)
            }
        }
    }
/// Resolves the request and retreives the event from the server.s
Resolves the request and retreives the event from the server.s
Resolves the request and retreives the event from the server . s
async fn resolve(&self) -> CalDavResult<IcalEvent> {
        let borrow = self.data.borrow();
        match &*borrow {
            EventPointerData::FetchedEvent(event) => Ok(event.clone()),
            EventPointerData::CreatedEventResponse { uid } => {
                let body_string = xml! {
                    <?xml version="1.0" encoding="utf-8" ?>
                    <C:calendar-query xmlns:C="urn:ietf:params:xml:ns:caldav">
                      <D:prop xmlns:D="DAV:">
                        <D:getetag/>
                        <C:calendar-data/>
                      </D:prop>
                      <C:filter>
                        <C:comp-filter name="VCALENDAR">
                          <C:comp-filter name="VEVENT">
                            <C:prop-filter name="UID">
                              <C:text-match collation="i;octet"
                              >{uid}</C:text-match>
                            </C:prop-filter>
                          </C:comp-filter>
                        </C:comp-filter>
                      </C:filter>
                    </C:calendar-query>
                }
                .to_string();
                let res = self
                    .client
                    .request(Method::from_bytes(REPORT).unwrap(), self.url.as_str())
                    .await?
                    .header("Content-Type", "application/xml; charset=\"utf-8\"")
                    .body(body_string)
                    .send()
                    .await?;
                let document = res.text().await.unwrap();
                let document = Document::parse(&document).unwrap();
                let event = get_calendar_data(document.descendants())
                    .map(|e| e.events)
                    .flatten()
                    .next()
                    .map(Ok)
                    .unwrap_or(Err(CalDavError::OtherError))?;
                std::mem::drop(borrow);
                let mut d = self.data.borrow_mut();
                *d = EventPointerData::FetchedEvent(event.clone());
                std::mem::drop(d);
                Ok(event)
            }
        }
    }
async fn resolve ( & self ) -> CalDavResult < IcalEvent > { let borrow = self . data . borrow ( ) ; match & * borrow { EventPointerData :: FetchedEvent ( event ) => Ok ( event . clone ( ) ) , EventPointerData :: CreatedEventResponse { uid } => { let body_string = xml ! { xml version " " encoding " " C calendar query xmlns C " " D prop xmlns D " " D getetag C calendar data D prop C filter C comp filter name " " C comp filter name " " C prop filter name " " C text match collation " " { uid } C text match C prop filter C comp filter C comp filter C filter C calendar query } . to_string ( ) ; let res = self . client . request ( Method :: from_bytes ( REPORT ) . unwrap ( ) , self . url . as_str ( ) ) . await ? . header ( " " , " \" \" " ) . body ( body_string ) . send ( ) . await ? ; let document = res . text ( ) . await . unwrap ( ) ; let document = Document :: parse ( & document ) . unwrap ( ) ; let event = get_calendar_data ( document . descendants ( ) ) . map ( | e | e . events ) . flatten ( ) . next ( ) . map ( Ok ) . unwrap_or ( Err ( CalDavError :: OtherError ) ) ? ; std :: mem :: drop ( borrow ) ; let mut d = self . data . borrow_mut ( ) ; * d = EventPointerData :: FetchedEvent ( event . clone ( ) ) ; std :: mem :: drop ( d ) ; Ok ( event ) } } }
Resolves the request and retreives the event from the server.s
Resolves the request and retreives the event from the server . s
&self