Skip to main content

Session

Trait Session 

Source
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§

Source

fn play(&mut self, script: &Script)

Plays script’s steps, in order.

Source

fn idle(&mut self, frames: u32)

Runs frames frames with no input.

Source

fn frame_count(&self) -> u32

How many frames have run.

Source

fn screens(&self) -> Vec<String>

The open screens’ names, bottom first.

Source

fn quit_frame(&self) -> Option<u32>

The frame the game asked to quit in, if it has.

Source

fn snapshot(&self) -> String

The current frame in the snapshot text format.

Source

fn events(&self) -> Vec<Event>

What happened, in frame order: screens opening and closing, music, voices, the quit, then the game’s own events.

Source

fn sounds(&self) -> Vec<Sound>

The sound cues asked for, in order.

Source

fn scene(&self) -> Result<Scene, String>

The scene on screen, or why there is none.

Provided Methods§

Source

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).

Source

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.

Source

fn sounds_added(&self) -> Vec<AddedSound>

The sounds the game added at run time and hasn’t removed, in cue order (none by default).

Source

fn log(&self) -> Vec<LogEntry>

The game’s log, oldest first: its last lines (none by default).

Source

fn log_dropped(&self) -> u32

How many older lines the log dropped (0 by default).

Source

fn modules(&self) -> Vec<ModuleEntry>

The modules installed in the game, in install order (none by default).

Source

fn set_perf(&mut self, on: bool)

Measures each frame from now on, or stops (false). By default a session measures nothing.

Source

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.

Source

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.

Source

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.

Source

fn picture(&self, scale: Option<u32>) -> Result<Image, String>

The current frame as the game paints it, each console pixel scale × scale (the game’s choice if None). By default the game offers none.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§