Trait atrium_api::types::Collection
source · pub trait Collection: Debug {
type Record: Debug + DeserializeOwned + Serialize;
const NSID: &'static str;
// Provided methods
fn nsid() -> Nsid { ... }
fn repo_path(rkey: &RecordKey) -> String { ... }
}Expand description
Trait for a collection of records that can be stored in a repository.
The records all have the same Lexicon schema.
Required Associated Types§
sourcetype Record: Debug + DeserializeOwned + Serialize
type Record: Debug + DeserializeOwned + Serialize
This collection’s record type.
Required Associated Constants§
Provided Methods§
sourcefn nsid() -> Nsid
fn nsid() -> Nsid
Returns the Nsid for the Lexicon that defines the schema of records in this
collection.
This is a convenience method that parses Self::NSID.
§Panics
Panics if Self::NSID is not a valid NSID.
sourcefn repo_path(rkey: &RecordKey) -> String
fn repo_path(rkey: &RecordKey) -> String
Returns the repo path for a record in this collection with the given record key.
Per the Repo Data Structure v3 specification:
Repo paths currently have a fixed structure of
<collection>/<record-key>. This means a valid, normalizedNsid, followed by a/, followed by a validRecordKey.
Object Safety§
This trait is not object safe.