Skip to main content

Module state

Module state 

Source
Expand description

Per-session state, and the operations a session can run on it.

SessionState owns everything a session works with: the open packs, the selected game, its schema and its dependencies. The operations live in the submodules, split by domain, and return plain results instead of protocol messages. crate::api translates the requests of the API into these operations.

ModulesΒ§

dependencies πŸ”’
Game selection and dependencies operations.
diagnostics πŸ”’
Diagnostics and Lua script operations.
files πŸ”’
File operations: create, add, delete, move, extract, decode and save files of the open packs, and read files from every data source.
packs πŸ”’
Pack lifecycle and metadata operations: open, create, save, close, flags, settings and notes.
schema πŸ”’
Schema operations: definitions, local patches, and updating the schema from the Assembly Kit.
search πŸ”’
Global search and replace operations.
tables πŸ”’
Table operations: merge, update, TSV import/export, key deletes, and lookups of table data and references across the open packs and the dependencies.
tools πŸ”’
Tool operations: optimizer, map packing, startpos and CEO building, translations, MyMods, animation ids, glTF export and plugin scripts.

StructsΒ§

ExtractOptions
Options for operations that write files of a pack to disk.
MyModOptions
Editor support to set up in a new MyMod folder.
PasteEntry πŸ”’
A file to paste. Only its path is stored: the file itself is cloned from its pack when pasting.
SaveOptions
Options for saving a pack.
SessionState
Everything a session owns. One instance lives in each session’s background loop.

EnumsΒ§

DecodedFile
Result of decoding a file.
MergeOutcome
Result of merging tables.

FunctionsΒ§

cached_lua_api πŸ”’
Returns the Lua scripting API of a game, rebuilding the cached one if it’s outdated.
decode_tables πŸ”’
Decodes the DB and Loc files among files, so they’re in memory for the diagnostics to work.
encode_extra_data πŸ”’
Returns the data needed to encode files of a pack for the provided game.
load_schema πŸ”’
Loads the schema of a game, re-decoding the tables of every open pack with it.
loaded_schema πŸ”’
Returns the loaded schema, or an error if there is none.
loaded_schema_mut πŸ”’
Returns the loaded schema mutably, or an error if there is none.
optimizer_options_with
Returns optimizer options with some of them changed, by name.
pack πŸ”’
Returns the open pack with the provided key.
pack_mut πŸ”’
Returns the open pack with the provided key, mutably.
pack_summary πŸ”’
Returns the short description of an open pack.
parent_pack_names πŸ”’
Returns the names of the parent packs of every open pack.
plugin_scripts
Returns the paths of the plugin scripts in the config’s scripts folder.

Type AliasesΒ§

LuaApiCache πŸ”’
Cached Lua scripting API: the docs path and dependencies build date it was built from, and the API itself.
PathsByPack
Paths of files, by the key of their pack.