pub trait Session {
Show 20 methods
// Required methods
fn play(&mut self, script: &Script);
fn idle(&mut self, frames: u32);
fn frame_count(&self) -> u32;
fn screens(&self) -> Vec<String>;
fn quit_frame(&self) -> Option<u32>;
fn snapshot(&self) -> String;
fn events(&self) -> Vec<Event>;
fn sounds(&self) -> Vec<Sound>;
fn scene(&self) -> Result<Scene, String>;
// Provided methods
fn actions(&self) -> Vec<String> { ... }
fn play_record(&mut self) -> Option<Played> { ... }
fn sounds_added(&self) -> Vec<AddedSound> { ... }
fn log(&self) -> Vec<LogEntry> { ... }
fn log_dropped(&self) -> u32 { ... }
fn modules(&self) -> Vec<ModuleEntry> { ... }
fn set_perf(&mut self, on: bool) { ... }
fn counts_process_heap(&self) -> bool { ... }
fn perf(&self, since: u64, max: u32) -> PerfRead { ... }
fn heap_snapshot(&mut self) -> Option<HeapSnapshot> { ... }
fn picture(&self, scale: Option<u32>) -> Result<Image, String> { ... }
}Expand description
A game running headless.
Required Methods§
Sourcefn frame_count(&self) -> u32
fn frame_count(&self) -> u32
How many frames have run.
Sourcefn quit_frame(&self) -> Option<u32>
fn quit_frame(&self) -> Option<u32>
The frame the game asked to quit in, if it has.
Provided Methods§
Sourcefn actions(&self) -> Vec<String>
fn actions(&self) -> Vec<String>
The game’s actions that have a key or a button now, in its action
set’s order: those a script’s act step can press (none by
default).
Sourcefn play_record(&mut self) -> Option<Played>
fn play_record(&mut self) -> Option<Played>
Plays the session record it was made ready for
(GameTools::session_from) to
its end, or its first frame that plays differently, and says how far
it has got. Asked again, it plays nothing more: its limits then say
what a script’s frames took over from it. None for a session
started from options, the default.
Sourcefn sounds_added(&self) -> Vec<AddedSound>
fn sounds_added(&self) -> Vec<AddedSound>
The sounds the game added at run time and hasn’t removed, in cue order (none by default).
Sourcefn log_dropped(&self) -> u32
fn log_dropped(&self) -> u32
How many older lines the log dropped (0 by default).
Sourcefn modules(&self) -> Vec<ModuleEntry>
fn modules(&self) -> Vec<ModuleEntry>
The modules installed in the game, in install order (none by default).
Sourcefn set_perf(&mut self, on: bool)
fn set_perf(&mut self, on: bool)
Measures each frame from now on, or stops (false). By default a
session measures nothing.
Sourcefn counts_process_heap(&self) -> bool
fn counts_process_heap(&self) -> bool
Whether its records’ heap counts are this tool program’s own heap counter’s, which counts the whole program (every thread’s allocations), not a fake’s. By default not.
Sourcefn perf(&self, since: u64, max: u32) -> PerfRead
fn perf(&self, since: u64, max: u32) -> PerfRead
The frames’ records kept, numbered since or more, the first max
of them (PerfRead). By default nothing, measured.
Sourcefn heap_snapshot(&mut self) -> Option<HeapSnapshot>
fn heap_snapshot(&mut self) -> Option<HeapSnapshot>
What holds the heap now, by memory tag, at the frames run: a fake
memory’s, or with perf on (set_perf) this
program’s heap counter’s, in a build that counts it. By default
none.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".