vstorage::base

Struct VcardItem

source
pub struct VcardItem { /* private fields */ }
Expand description

Immutable wrapper around a VCARD.

Note that this is not a proper validating parser for vcard; it’s a very simple one with the sole purpose of extracing a UID. Proper parsing of components is out of scope, since we want to enable operating on potentially invalid items too.

Trait Implementations§

source§

impl Clone for VcardItem

source§

fn clone(&self) -> VcardItem

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for VcardItem

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl From<String> for VcardItem

source§

fn from(value: String) -> Self

Creates a new instance from valid Vcard data.

source§

impl Item for VcardItem

source§

fn uid(&self) -> Option<String>

Returns a unique identifier for this item.

The UID does not change when the item is modified. The UID must remain the same when the item is copied across storages and storage types.

source§

fn hash(&self) -> String

Returns the hash of the normalised content.

source§

fn with_uid(&self, new_uid: &str) -> Self

Returns a new copy of this Item with the supplied UID.

source§

fn as_str(&self) -> &str

Returns the raw contents of this item.

source§

type Property = AddressBookProperty

Property types supported by storages. Read more
source§

fn ident(&self) -> String

A unique identifier for this item. Is either the UID (if any), or the hash of its contents.
source§

impl<C> Storage<VcardItem> for CardDavStorage<C>
where C: Service<Request<String>, Response = Response<Incoming>> + Send + Sync + 'static, C::Error: Error + Send + Sync, C::Future: Send + Sync,

source§

fn discover_collections<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Discovery, Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Finds existing collections for this storage.

Will only return collections stored under the principal’s home set. In most common scenarios, this implies that only collections owned by the current user are found and not other collections.

Collections outside the principal’s home set can be referenced by using an absolute path.

source§

fn destroy_collection<'life0, 'life1, 'async_trait>( &'life0 self, href: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Deletes a carddav collection.

This method does multiple network calls to ensure that the collection is empty. If the server property supports Etag (it MUST as per the spec), this method guarantees that the collection is empty when deleting it.

If the server is not compliant and does not support Etags, possible race conditions could occur and if contacts components are added to the collection concurrently, they may be deleted.

source§

fn set_property<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, href: &'life1 str, prop: AddressBookProperty, value: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

§Errors

Only DisplayName is implemented.

source§

fn unset_property<'life0, 'life1, 'async_trait>( &'life0 self, href: &'life1 str, prop: AddressBookProperty, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

§Errors

Only DisplayName is implemented.

source§

fn get_property<'life0, 'life1, 'async_trait>( &'life0 self, href: &'life1 str, prop: AddressBookProperty, ) -> Pin<Box<dyn Future<Output = Result<Option<String>, Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Read metadata from a collection.

Metadata is fetched using the PROPFIND method under the hood. Some servers may not support some properties.

§Errors

If the underlying HTTP connection fails or if the server returns invalid data.

Only DisplayName is implemented.

source§

fn href_for_collection_id(&self, id: &CollectionId) -> Result<Href, Error>

§Errors

Returns ErrorKind::PreconditionFailed if a home set was not found in the carddav server.

source§

fn check<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Checks that the storage works. This includes validating credentials, and reachability. Read more
source§

fn create_collection<'life0, 'life1, 'async_trait>( &'life0 self, href: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Collection, Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Creates a new collection with a specified href.
source§

fn list_items<'life0, 'life1, 'async_trait>( &'life0 self, collection_href: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Vec<ItemRef>, Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Enumerates items in a given collection.
source§

fn get_item<'life0, 'life1, 'async_trait>( &'life0 self, href: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<(VcardItem, Etag), Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Fetches a single item from given collection. Read more
source§

fn get_many_items<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, hrefs: &'life1 [&'life2 str], ) -> Pin<Box<dyn Future<Output = Result<Vec<FetchedItem<VcardItem>>, Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Fetches multiple items. Read more
source§

fn get_all_items<'life0, 'life1, 'async_trait>( &'life0 self, collection_href: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Vec<FetchedItem<VcardItem>>, Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Fetch all items from a given collection. Read more
source§

fn add_item<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, collection_href: &'life1 str, item: &'life2 VcardItem, ) -> Pin<Box<dyn Future<Output = Result<ItemRef, Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Saves a new item into a given collection
source§

fn update_item<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, href: &'life1 str, etag: &'life2 Etag, item: &'life3 VcardItem, ) -> Pin<Box<dyn Future<Output = Result<Etag, Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Updates the contents of an existing item.
source§

fn delete_item<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, href: &'life1 str, etag: &'life2 Etag, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Deletes an existing item.
source§

fn list_properties<'life0, 'life1, 'async_trait>( &'life0 self, collection_href: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Vec<ListedProperty<AddressBookProperty>>, Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

List all properties of a collection.
source§

fn monitor<'life0, 'async_trait>( &'life0 self, bufsize: NonZeroUsize, ) -> Pin<Box<dyn Future<Output = Result<Receiver<Event>, Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Monitor the storage for changes. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> CloneToUninit for T
where T: Clone,

source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<Source, Target> OctetsInto<Target> for Source
where Target: OctetsFrom<Source>,

source§

type Error = <Target as OctetsFrom<Source>>::Error

source§

fn try_octets_into( self, ) -> Result<Target, <Source as OctetsInto<Target>>::Error>

Performs the conversion.
source§

fn octets_into(self) -> Target
where Self::Error: Into<Infallible>,

Performs an infallible conversion.
source§

impl<T> Pointable for T

source§

const ALIGN: usize = _

The alignment of pointer.
source§

type Init = T

The type for initializers.
source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> Same for T

source§

type Output = T

Should always be Self
source§

impl<T> ToOwned for T
where T: Clone,

source§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

source§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

source§

fn vzip(self) -> V

source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more