Skip to main content

Crate gammaloop_api

Crate gammaloop_api 

Source
Expand description

Rust facade for loading a GammaLoop state and driving its command session.

This crate owns GammaLoop’s persistent state, run-card, command, CLI, and Python-facing lifecycle. The numerical integrand and event contracts live in gammalooprs. Embedded Rust callers normally configure StateLoadOption, call StateLoadOption::load, and borrow a session::CliSession from the resulting LoadedState.

Loading is not a pure deserialization step: it initializes process-global services, configures tracing, can apply a boot card, and can remove the resolved state path when clean_state is selected. Dropping LoadedState does not save it. Commands decide whether to mutate the in-memory state, write an explicitly requested export, or return a save/quit request.

§Embedded lifecycle

The following example is compile-checked but not run as a doctest because GammaLoop startup can require process-global Symbolica initialization and licensed features.

use std::ops::ControlFlow;

use gammaloop_api::{
    commands::CommandOutput, state::CommandHistory, StateLoadOption,
};

let temporary = tempfile::tempdir()?;
let mut loaded = StateLoadOption {
    state_folder: Some(temporary.path().join("state")),
    read_only_state: true,
    ..StateLoadOption::default()
}
.load()?;
assert!(loaded.state_load_summary.is_none());

let execution = {
    let mut session = loaded.cli_session();
    let command = CommandHistory::from_raw_string("display settings global")?;
    session.execute_command(command)?
};
assert!(matches!(execution.flow, ControlFlow::Continue(())));
assert!(matches!(execution.output, CommandOutput::None));

Modules§

commands
Typed command definitions and command-execution results.
completion
integrand_info
repl
session
Borrowed command-session access to a loaded GammaLoop state.
state
templates
tracing

Structs§

CLISettings
LoadedState
Owned state and settings produced by StateLoadOption::load.
OneShot
Parsed
Repl
SessionSettings
StateLoadOption
Programmatic startup options for an embedded GammaLoop session.
StateLoadSummary
Diagnostic measurements available only when an existing manifested state was loaded.
StateSettings

Enums§

Log
StateAccessMode

Functions§

write_schemas