pub struct ModelCatalog {
pub schema: String,
pub catalog_version: String,
pub price_version: String,
pub models: Vec<CatalogModel>,
pub direct: Vec<DirectVendor>,
}Fields§
§schema: String§catalog_version: String§price_version: String§models: Vec<CatalogModel>§direct: Vec<DirectVendor>Implementations§
Source§impl ModelCatalog
impl ModelCatalog
Sourcepub fn from_json(text: &str) -> Result<Self, String>
pub fn from_json(text: &str) -> Result<Self, String>
Parse and check the document: schema, country codes, at least one host per model. A catalog that fails is never used (fail closed).
Sourcepub fn model(&self, id: &str) -> Option<&CatalogModel>
pub fn model(&self, id: &str) -> Option<&CatalogModel>
The model id, if listed.
Sourcepub fn direct_vendor(&self, host: &str) -> Option<&DirectVendor>
pub fn direct_vendor(&self, host: &str) -> Option<&DirectVendor>
The vendor whose own API host is (exact or a subdomain of a listed
host; case-insensitive, trailing dot ignored).
Trait Implementations§
Source§impl Clone for ModelCatalog
impl Clone for ModelCatalog
Source§impl Debug for ModelCatalog
impl Debug for ModelCatalog
Source§impl<'de> Deserialize<'de> for ModelCatalog
impl<'de> Deserialize<'de> for ModelCatalog
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 ModelCatalog
Source§impl PartialEq for ModelCatalog
impl PartialEq for ModelCatalog
Source§impl Serialize for ModelCatalog
impl Serialize for ModelCatalog
impl StructuralPartialEq for ModelCatalog
Auto Trait Implementations§
impl Forget for ModelCatalog
impl Freeze for ModelCatalog
impl Move for ModelCatalog
impl RefUnwindSafe for ModelCatalog
impl Send for ModelCatalog
impl Sync for ModelCatalog
impl Unpin for ModelCatalog
impl UnsafeUnpin for ModelCatalog
impl UnwindSafe for ModelCatalog
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