pub struct Catalog {
pub catalog_schema: u32,
pub topics: Vec<Topic>,
}Expand description
The whole catalog, parsed.
Fields§
§catalog_schema: u32Always SCHEMA once parsed.
topics: Vec<Topic>Every topic, in authored order.
Implementations§
Source§impl Catalog
impl Catalog
Sourcepub fn parse(bytes: &[u8]) -> Result<Self, CatalogError>
pub fn parse(bytes: &[u8]) -> Result<Self, CatalogError>
Read one catalog.
§Errors
CatalogError when the bytes do not parse or the schema is one
this engine does not read.
Sourcepub fn for_document(&self, on: ShelfId, wanted: &str) -> Option<&Topic>
pub fn for_document(&self, on: ShelfId, wanted: &str) -> Option<&Topic>
The topic serving one shelf document, where the catalog has one.
Sourcepub fn resolve(&self, query: &str) -> Result<&Topic, Unresolved>
pub fn resolve(&self, query: &str) -> Result<&Topic, Unresolved>
Turn one query into exactly one topic.
The order is exact id, then exact alias, then a case-folded prefix over both. An ambiguous query names every candidate rather than picking one, because a reader who asked loosely gets a shorter list and never a document they did not mean.
§Errors
Unresolved naming either the candidates or the nearest ids.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Catalog
impl<'de> Deserialize<'de> for Catalog
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for Catalog
impl StructuralPartialEq for Catalog
Auto Trait Implementations§
impl Freeze for Catalog
impl RefUnwindSafe for Catalog
impl Send for Catalog
impl Sync for Catalog
impl Unpin for Catalog
impl UnsafeUnpin for Catalog
impl UnwindSafe for Catalog
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.