Expand description
§nwnrs-resman
nwnrs-resman defines the central resource-resolution model used by the rest
of the workspace.
§Scope
- model a single payload as
Res - model a source of payloads as
ResContainer - resolve multiple containers in precedence order through
ResMan - provide optional weighted caching for repeated lookups
This crate is intentionally abstract. The container crates supply concrete
backends; nwnrs-resman supplies the common lookup algebra.
§Example
use nwnrs_resman::ResMan;
let resman = ResMan::new(64);
assert!(resman.contents().is_empty());§Public Surface
§Core aliases and constants
MEMORY_CACHE_THRESHOLDReadSeekSharedReadSeekResIoSpawner
§Cache behavior
CachePolicy
§Error and result vocabulary
ResManErrorResManResult
§Resource identity and provenance
ResOriginnew_res_originshared_stream
§Resource payload model
Res
§Container abstraction
ResContainer
§Manager
ResMan
§Important ResMan operations
ResMan::newResMan::containsResMan::demandResMan::contentsResMan::get_resolvedResMan::getResMan::addResMan::containersResMan::removeResMan::remove_atResMan::cache
§Logical Edges
- precedence order is front-to-back; newly added containers shadow older ones
containsanddemandcan consult or bypass the manager cache according toCachePolicyResis lazy and owns decompression metadata as part of the resource model- small decoded payloads may be memoized inside
Res::read_all ResOriginis provenance for diagnostics, not identity- the
ResContainertrait is intentionally abstract so different storage forms can plug into the same lookup model
§Why This Crate Exists
This crate is the core of install-backed and archive-backed tooling. Without it, every workflow would need to hard-code its own precedence policy across directories, KEY/BIF sets, ERFs, and manifests.
§See also
nwnrs-resdir, the directory-backedResContainerimplementationnwnrs-resfile, the single-fileResContainerimplementationnwnrs-resmemfile, the in-memoryResContainerimplementationnwnrs-resnwsync, theNWSync-backedResContainerimplementationnwnrs-install, which assembles a conventional install-backed manager
Modules§
- prelude
- Common imports for consumers of this crate.
Structs§
- Res
- A lazily readable NWN resource payload.
- ResMan
- Layered resource manager.
- ResOrigin
- Human-readable origin information for a
Res.
Enums§
- Cache
Policy - Cache behavior for resource reads and cache-aware loaders.
- ResMan
Error - Errors returned by resource-container and resource-manager operations.
Constants§
- MEMORY_
CACHE_ THRESHOLD - Maximum payload size that
Res::read_allwill retain in the per-resource cache.
Traits§
- Read
Seek - Convenience trait alias for readable, seekable streams.
- ResContainer
- Trait implemented by all resource containers in the workspace.
Functions§
- new_
res_ origin - Convenience constructor for
ResOrigin. - shared_
stream - Wraps a stream in the shared-handle type used by stream-backed resources.
Type Aliases§
- ResIo
Spawner - Factory for creating a fresh readable, seekable stream on demand.
- ResMan
Result - Result type for resource-manager operations.
- Shared
Read Seek - Shared stream handle used by stream-backed
Resvalues.