#[non_exhaustive]pub struct ModuleJson {
pub app: App,
pub module: Module,
pub notes: Vec<Note>,
pub unmodelled: Vec<String>,
/* private fields */
}Expand description
A parsed module.json.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.app: AppThe app object.
module: ModuleThe module object.
notes: Vec<Note>Fields that were present but wrongly typed, and so skipped.
unmodelled: Vec<String>JSON paths of fields this model has no place for; read them from
ModuleJson::raw.
Implementations§
Source§impl ModuleJson
impl ModuleJson
Sourcepub fn parse(bytes: &[u8]) -> Result<Self, HapError>
pub fn parse(bytes: &[u8]) -> Result<Self, HapError>
Read a module.json.
§Errors
Only when bytes is not JSON or its root is not an object. Missing,
unknown and wrongly typed fields never fail the document: see
ModuleJson::notes and ModuleJson::unmodelled.
Sourcepub fn components(&self) -> impl Iterator<Item = &Ability>
pub fn components(&self) -> impl Iterator<Item = &Ability>
Abilities, then extension abilities, in document order.
Sourcepub fn summary_lines(&self) -> Vec<String>
pub fn summary_lines(&self) -> Vec<String>
One fact per line, the first word naming the record: bundle,
app-env, module, module-metadata, dependency, query-scheme,
proxy-data, request-permission, define-permission,
test-runner, atomic-service, then per component ability or
extension followed by its skill, uri, deeplink and
metadata lines (each carrying the component name), and finally
unmodelled and note.
Absent values print as -; values with whitespace print as JSON
string literals. exported= is always printed, with (explicit)
or (default) telling whether the document said so.
Sourcepub fn summary(&self) -> String
pub fn summary(&self) -> String
ModuleJson::summary_lines joined, each line newline-terminated.
Source§impl ModuleJson
impl ModuleJson
Sourcepub fn record_names(
&self,
src_entry: &str,
packages: Option<&PkgContextInfo>,
) -> RecordNames
pub fn record_names( &self, src_entry: &str, packages: Option<&PkgContextInfo>, ) -> RecordNames
Record names for a srcEntry of this module (an ability’s, an
extension’s or the module’s own): ./ets/entryability/EntryAbility.ets.
Pass the package’s pkgContextInfo.json when it has one: it
supplies the module’s source root and version, and its presence
puts the normalized spelling first.
Sourcepub fn route_record_names(
&self,
route: &Route,
packages: Option<&PkgContextInfo>,
) -> RecordNames
pub fn route_record_names( &self, route: &Route, packages: Option<&PkgContextInfo>, ) -> RecordNames
Record names for the page of a route of this module’s route table.
The route’s ohmurl spells the record outright; without one the
name is put together from pageSourceFile and the package that has
it (packageName, else the module’s own), with the version
packages lists for that package. A page of the module itself has
the <bundle>/<module>/ets/… spelling besides.