Crate naviz_repository¶
- crate naviz_repository¶
Repository for loading configs. Also contains bundled configs.
Modules
Functions
Structs and Unions
- struct Repository(HashMap<String, RepositoryEntry>)¶
A repository of config files.
Implementations
- impl Repository¶
Functions
- fn bundled_machines(self) -> Result<Self>¶
Loads the bundled machines into the passed Repository
- fn bundled_styles(self) -> Result<Self>¶
Loads the bundles styles into the passed Repository
- fn empty() -> Self¶
Creates a new empty repository
-
fn get<C>(&self, id: &str) -> Option<Result<C>>¶
where
Config: TryInto<C, Error = naviz_parser::config::error::Error>
¶ Tries to get the contents of the entry with the passed
idas some Config.Returns:
None: No entry with the passedidexistsSome(Err): An entry exists, but failed to load the data or failed to convert toCSome(Ok): The config of the found entry
- fn get_raw<'a>(&'a self, id: &str) -> Option<Result<Cow<'a, [u8]>>>¶
Tries to get the raw contents of the entry with the passed
id.Returns:
None: No entry with the passedidexistsSome(Err): An entry exists, but failed to load the dataSome(Ok): The data of the found entry
- fn has(&self, id: &str) -> bool¶
Checks whether the repository has an entry with
id
- fn import_machine_to_user_dir(&mut self, file: &Path) -> Result<()>¶
Import a machine into the user-directory. Will validate that the config can be parsed into a valid MachineConfig.
- fn import_style_to_user_dir(&mut self, file: &Path) -> Result<()>¶
Import a style into the user-directory. Will validate that the config can be parsed into a valid VisualConfig.
- fn list(&self) -> impl Iterator<Item = (&str, &str, bool)>¶
The list of entries of this repository:
(id, name, removable)-pairs
- fn remove_from_user_dir(&mut self, id: &str) -> Result<()>¶
Delete an imported config from the user dir.
-
fn try_get_any<C>(&self) -> Option<(&str, C)>¶
where
Config: TryInto<C>
¶ Try to get any config from this repository
- fn user_dir_machines(self) -> Result<Self>¶
Loads the machines from the user-directory into the passed Repository
- fn user_dir_styles(self) -> Result<Self>¶
Loads the styles from the user-directory into the passed Repository