#[non_exhaustive]pub struct Ecosystem {
pub schema_version: String,
pub games: HashMap<String, GameDef>,
pub modloader_packages: Vec<ModloaderPackage>,
}Expand description
A parsed ecosystem schema: the known games plus the mod-loader package registry.
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.schema_version: StringThe schema version string reported by the source (e.g. "0.3.0").
games: HashMap<String, GameDef>All known games, keyed by their community slug.
modloader_packages: Vec<ModloaderPackage>Every package that is itself a mod-loader pack, with its unpack root.
Implementations§
Source§impl Ecosystem
impl Ecosystem
Sourcepub fn bundled() -> Self
pub fn bundled() -> Self
Loads the bundled ecosystem snapshot embedded in the binary.
§Panics
Panics if the bundled snapshot fails to decompress or parse, which is a
build-time invariant. Use Ecosystem::try_bundled to handle the error.
§Examples
Routing works offline with no network call, which is the point of the bundled snapshot:
use thunderstore_engine::ecosystem::Ecosystem;
let eco = Ecosystem::bundled();
assert!(eco.games().count() > 0);
assert!(eco.game("valheim").is_some());Sourcepub fn try_bundled() -> Result<Self>
pub fn try_bundled() -> Result<Self>
Loads the bundled ecosystem snapshot, returning an error instead of panicking if it cannot be decompressed or parsed.
Sourcepub async fn fetch_latest(client: &Client, url: &str) -> Result<Self>
pub async fn fetch_latest(client: &Client, url: &str) -> Result<Self>
Fetches the latest ecosystem snapshot from url and parses it.
Use DEFAULT_ECOSYSTEM_URL for the default location. The response is
fully trusted to define install routing, so only fetch from a source you
trust — see the DEFAULT_ECOSYSTEM_URL trust note. The response body is
size-bounded (see MAX_ECOSYSTEM_BYTES) so a misbehaving endpoint cannot
force unbounded allocation.
Sourcepub fn game(&self, slug: &str) -> Option<&GameDef>
pub fn game(&self, slug: &str) -> Option<&GameDef>
Returns the game definition for a community slug, if known.
Sourcepub fn modloader_package(
&self,
package_full_name: &str,
) -> Option<&ModloaderPackage>
pub fn modloader_package( &self, package_full_name: &str, ) -> Option<&ModloaderPackage>
Looks up a package in the mod-loader registry by its Owner-Name
identifier, returning its entry if the package is a loader pack.
This is the reverse lookup that replaces per-game loader configuration: a
package that appears here is unpacked to the profile root (see
ModloaderPackage::root_folder); anything else is routed as a regular
mod via the game’s InstallRules.