#single #player #interface #text #nzsc #wrapper #textual

nzsc_single_player_text_interface

A textual wrapper for nzsc_single_player

4 releases

Uses old Rust 2015

0.2.2 Jun 1, 2018
0.2.1 May 31, 2018
0.2.0 May 31, 2018
0.1.0 May 31, 2018

#12 in #textual

MIT license

9KB
165 lines

nzsc_single_player_text_interface

A textual wrapper for nzsc_single_player.

Starting with v0.5.0, nzsc_single_player::single_player_game::SinglePlayerNZSCGame no longer returns strings that the dependent application can use. Instead, it returns an nzsc_single_player::io::Output, leaving the details of how that Output object is displayed up to the dependent application.

Writing a command-line interface would now require much more code, because you now have to implement the stringifiers yourself.

This project is meant to be a drop-in solution for that.

It provides an easy way to convert nzsc_single_player::io::Outputs to strings (designed to be printed to a command-line):

extern crate nzsc_single_player_text_interface;
use nzsc_single_player_text_interface::{ question, notification };

let question: nzsc::io::Question = /*...*/;
let notification: nzsc::io::Notification = /*...*/;

let s = question::to_string(&question);
let s = notification::to_string(&notification);

Dependencies

~48KB