pub trait Item:
Sync
+ Send
+ Debug
+ Clone{
type Property: Property;
// Required methods
fn uid(&self) -> Option<String>;
fn hash(&self) -> String;
fn with_uid(&self, new_uid: &str) -> Self;
fn as_str(&self) -> &str;
// Provided method
fn ident(&self) -> String { ... }
}
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 Property: Property
type Property: Property
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 original vdirsyncer implementation.
See also Storage::get_property
and Storage::set_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
remains the same when the
item is copied across storages and storage types.
sourcefn hash(&self) -> String
fn hash(&self) -> String
Return the hash of this item, usually normalised.
Implementations SHOULD normalise content before hashing to ensure that two semantically equivalent items return the same hash.
This value is used as a fallback when a storage backend doesn’t provide Etag
values, or
when an item’s Item::uid
returns None
.