pub struct ModelCatalogue {
pub version: u32,
pub vendors: Vec<Vendor>,
pub models: Vec<ModelEntry>,
}Expand description
The whole catalogue, as share/models.yaml declares it.
Fields§
§version: u32The format version.
vendors: Vec<Vendor>The vendors, in declaration order.
models: Vec<ModelEntry>The models, in declaration order — which is also routing’s preference order: the first satisfying model wins, and “why this one” is “it came first among those that qualify”, an answer a person can verify by reading the file.
Implementations§
Source§impl ModelCatalogue
impl ModelCatalogue
Sourcepub fn load(share: &Path) -> Result<ModelCatalogue, String>
pub fn load(share: &Path) -> Result<ModelCatalogue, String>
Load the catalogue from a share directory. No file is an empty catalogue — a distribution that declares no models has none, which is an answer; a file that does not parse is an error naming it.
Sourcepub fn resolve(&self, name: &str) -> Option<&ModelEntry>
pub fn resolve(&self, name: &str) -> Option<&ModelEntry>
The entry a canonical id or an alias resolves to.
Sourcepub fn vendor_of(&self, entry: &ModelEntry) -> Option<&Vendor>
pub fn vendor_of(&self, entry: &ModelEntry) -> Option<&Vendor>
The declared vendor of an entry.
Sourcepub fn diagnostics(&self) -> Vec<String>
pub fn diagnostics(&self) -> Vec<String>
The catalogue’s own consistency: duplicate ids or aliases, and a model naming a vendor the catalogue does not declare. Reported, never repaired.
Trait Implementations§
Source§impl Clone for ModelCatalogue
impl Clone for ModelCatalogue
Source§fn clone(&self) -> ModelCatalogue
fn clone(&self) -> ModelCatalogue
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ModelCatalogue
impl Debug for ModelCatalogue
Source§impl Default for ModelCatalogue
impl Default for ModelCatalogue
Source§fn default() -> ModelCatalogue
fn default() -> ModelCatalogue
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for ModelCatalogue
impl<'de> Deserialize<'de> for ModelCatalogue
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
Source§impl JsonSchema for ModelCatalogue
impl JsonSchema for ModelCatalogue
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Returns a string that uniquely identifies the schema produced by this type. Read more
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Generates a JSON Schema for this type. Read more
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
Whether JSON Schemas generated for this type should be included directly in parent schemas,
rather than being re-used where possible using the
$ref keyword. Read moreAuto Trait Implementations§
impl Freeze for ModelCatalogue
impl RefUnwindSafe for ModelCatalogue
impl Send for ModelCatalogue
impl Sync for ModelCatalogue
impl Unpin for ModelCatalogue
impl UnsafeUnpin for ModelCatalogue
impl UnwindSafe for ModelCatalogue
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