Skip to main content

Headless

Struct Headless 

Source
pub struct Headless<G: GameData> { /* private fields */ }
Expand description

A Session over a game’s Harness.

Implementations§

Source§

impl<G: GameData> Headless<G>

Source

pub fn new(harness: Harness<G>) -> Self

A session of harness, with no scene and no events of the game’s.

Source

pub fn with_scene( self, scene: impl Fn(&Harness<G>) -> Result<Scene, String> + 'static, ) -> Self

This session, its scene from scene.

Source

pub fn with_events( self, events: impl Fn(&Harness<G>) -> Vec<String> + 'static, ) -> Self

This session, the game’s events from events.

Source

pub fn with_picture( self, picture: impl Fn(&Harness<G>, Option<u32>) -> Result<Image, String> + 'static, ) -> Self

This session, its frame painted by picture (most simply the game’s frame-png painter over the Harness’s frame).

Source

pub fn harness(&self) -> &Harness<G>

The Harness it drives.

Trait Implementations§

Source§

impl<G: GameData> Session for Headless<G>

Source§

fn set_perf(&mut self, on: bool)

Gives the Harness this machine’s clock, and in a build that counts the heap this program’s heap counter and its memory tags (and tags the asset decodes), each unless its platform has one already (a test’s fake, kept so its records stay the same); false takes away what it gave. Before the game has loaded it does nothing.

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 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 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 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 scene(&self) -> Result<Scene, String>

The scene on screen, or why there is none.
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 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.

Auto Trait Implementations§

§

impl<G> !RefUnwindSafe for Headless<G>

§

impl<G> !Send for Headless<G>

§

impl<G> !Sync for Headless<G>

§

impl<G> !UnwindSafe for Headless<G>

§

impl<G> Freeze for Headless<G>

§

impl<G> Unpin for Headless<G>
where <G as GameData>::Voice: Unpin,

§

impl<G> UnsafeUnpin for Headless<G>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.