loadsmith-registry 0.3.0

Registry abstraction and built-in sources for the loadsmith mod-manager library
Documentation

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"));