Expand description
Registry abstraction and built-in sources for the loadsmith mod-manager library.
This is an internal crate of the [loadsmith] workspace. Most consumers
should depend on the loadsmith facade crate instead of using this
crate directly.
§Examples
use loadsmith_registry::{RegistrySet, OfflineRegistry, Package, PackageVersion};
use loadsmith_core::{PackageId, Version, FileUrl};
use std::collections::HashMap;
// Register an offline (pre-defined) source alongside other registries.
let mut set = RegistrySet::new();
let pkg = Package::new(
PackageId::new("author-name"),
vec![PackageVersion::new(
Version::new(1, 0, 0),
FileUrl::try_from_url("https://example.com/pkg.zip").unwrap(),
)],
);
let mut packages = HashMap::new();
packages.insert(PackageId::new("author-name"), pkg);
set.add("offline", OfflineRegistry::new(packages));
let registry = set.get("offline").expect("offline registry should exist");
assert!(format!("{registry:?}").contains("OfflineRegistry"));Modules§
- local
- A registry that resolves packages from the local filesystem.
- offline
- An in-memory registry with pre-loaded static package data.
Structs§
- Local
Registry - A registry that reads package data from the local filesystem.
- Offline
Registry - An in-memory registry pre-populated with static package data.
- Registry
Set - A named collection of
Registryimplementations. - Resolved
Version - The fully resolved metadata for a specific package version.
- Version
Info - A single available version reported by a registry.
Enums§
- Error
- Errors returned by registry operations.
Traits§
- Registry
- A source that can list available versions and resolve package references.
Functions§
- read_
metadata - Deserialize
metadatafrom an optional JSON value. - read_
metadata_ or_ default - Deserialize
metadatafrom an optional JSON value, or returnT::default()whenmetadataisNone.
Type Aliases§
- Result
- Convenience alias for
std::result::Resultwhose error type isError.