pub trait Item: Sync + Send + Debugwhere
Self: From<String>,{
type CollectionProperty: Sync + Send;
// Required methods
fn uid(&self) -> Option<String>;
fn hash(&self) -> String;
fn ident(&self) -> String;
fn with_uid(&self, new_uid: &str) -> Self;
fn as_str(&self) -> &str;
}
Expand description
A type of item that is contained in a Storage
.
A Storage
can contain items of a concrete type described by implementations of this trait.
This trait defines how to extract the basic information that is required to synchronise
storages. Additional parsing is out of scope here and should be done by inspecting the raw data
inside an item via Item::as_str
.
Required Associated Types§
sourcetype CollectionProperty: Sync + Send
type CollectionProperty: Sync + Send
Property types supported by storages.
Generally, this type should be an enum
with each known property represented as a
different variant.
These were known as “metadata” in the previous vdirsyncer implementation.
See also Storage::get_collection_property
and Storage::get_collection_property
.
Required Methods§
sourcefn uid(&self) -> Option<String>
fn uid(&self) -> Option<String>
Parse the item and return a unique identifier for it.
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.
sourcefn ident(&self) -> String
fn ident(&self) -> String
A unique identifier for this item. Is either the UID (if any), or the hash of its contents.