Struct vstorage::CollectionId
source · pub struct CollectionId { /* private fields */ }
Expand description
An identifier for a collection.
Collection identifiers are a short string that uniquely identify a collection inside a storage.
They are based on the href
of a collection, which never changes. The CollectionId
is
intended as a more human-friendly substitute for collection href
s.
The following limitations exist, given that such values would produce ambiguous results with
the implementation of VdirStorage
, CalDavStorage
, and CardDavStorage
:
- A
CollectionId
cannot contain a/
(slash) - A
CollectionId
cannot be exactly..
(double period). - A
CollectionId
cannot be exactly.
(a single period).
§Creating instances
Instances of CollectionId
always contain previously validated data.
See: CollectionId::try_from
and CollectionId::from_str
.
Trait Implementations§
source§impl AsRef<str> for CollectionId
impl AsRef<str> for CollectionId
source§impl Clone for CollectionId
impl Clone for CollectionId
source§fn clone(&self) -> CollectionId
fn clone(&self) -> CollectionId
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for CollectionId
impl Debug for CollectionId
source§impl Display for CollectionId
impl Display for CollectionId
source§impl From<CollectionId> for String
impl From<CollectionId> for String
source§fn from(value: CollectionId) -> String
fn from(value: CollectionId) -> String
source§impl FromStr for CollectionId
impl FromStr for CollectionId
source§fn from_str(s: &str) -> Result<Self, Self::Err>
fn from_str(s: &str) -> Result<Self, Self::Err>
Creates a new CollectionId
with the input data.
When converting a String
, use CollectionId::try_from
instead to avoid re-allocating
the string data.
§Example
let collection_id: CollectionId = "personal".parse().unwrap();
§type Err = CollectionIdError
type Err = CollectionIdError
source§impl Hash for CollectionId
impl Hash for CollectionId
source§impl PartialEq for CollectionId
impl PartialEq for CollectionId
source§fn eq(&self, other: &CollectionId) -> bool
fn eq(&self, other: &CollectionId) -> bool
self
and other
values to be equal, and is used
by ==
.source§impl TryFrom<String> for CollectionId
impl TryFrom<String> for CollectionId
source§fn try_from(value: String) -> Result<Self, Self::Error>
fn try_from(value: String) -> Result<Self, Self::Error>
Converts a String
instance into a CollectionId
.
Note that manually allocating a String
before calling this method is an anti-pattern; the
cost of the re-allocation is paid even if the validation fails. For converting &str
,
see CollectionId::from_str
.