Module state

Source
Expand description

Used to construct a state by feeding it events from the journal logs which can then be used to create relations between events and create a history. Below is a simple example on how to read logs and feed then into the state:

use std::env::current_dir;
use ed_journals::logs::blocking::LogDirReader;
use ed_journals::state::GameState;

let path = current_dir()
    .unwrap()
    .join("test-files")
    .join("journals");

// Create a reader and an empty game state
let mut log_reader = LogDirReader::open(&path);
let mut state = GameState::default();

// Read all the entries from the journal logs
for entry in log_reader {
    state.feed(&entry.unwrap());
}

Modules§

resolvers
Resolvers which are used to build up the state. You shouldn’t use these directly, but instead should use one of the type aliases that use StateContainer, like LogState. Resolves are the parts of state that accumulate the events and create usable data from them. They are not made to be used directly, but instead they are wrapped by StateContainer and type aliased.

Structs§

CurrentOrganicProgress
GameCommanderEntry
JournalCommanderEntry
LiveStateEntry
LiveStateEntryOwned
OrganicLocation
A confirmed location of a specific organic on a planet.
PlanetSpeciesEntry
ShipEntry
StateContainer
This is what is used internally take care of input and manage flushing and handling retries.
TouchdownLocation
TransferringShipStatus
Information about the current transfer status.

Enums§

ShipStatus
The status of the ship.

Type Aliases§

CarrierState
GameState
The complete state of the whole game. This includes potentially the different commanders that use the same game installation. By feeding the state entries from the journal log files it creates a state which makes it easier to read information about the game.
JournalState
Journal state tracks both log and live events from json files. It’s important to note however that state that is built from the json files is volatile and is only kept in memory. To save that part of the state you need to call JournalStateResolver::all_live_state and save the contents somewhere. Then, when you create your journal state again, use the From trait to create your instance, after which you can just feed state like normal again.
LiveState
LogState
MaterialsState
MissionState
PlanetState
ShipyardState
SystemState