Skip to main content

Crate loadsmith_registry

Crate loadsmith_registry 

Source
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§

LocalRegistry
A registry that reads package data from the local filesystem.
OfflineRegistry
An in-memory registry pre-populated with static package data.
RegistrySet
A named collection of Registry implementations.
ResolvedVersion
The fully resolved metadata for a specific package version.
VersionInfo
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 metadata from an optional JSON value.
read_metadata_or_default
Deserialize metadata from an optional JSON value, or return T::default() when metadata is None.

Type Aliases§

Result
Convenience alias for std::result::Result whose error type is Error.