pub struct CliFrontend { /* private fields */ }Expand description
A frontend that uses stdin and stdout
Implementations§
Source§impl CliFrontend
impl CliFrontend
Sourcepub fn new() -> Self
pub fn new() -> Self
Create a new CliFrontend
Examples found in repository?
More examples
examples/rooms.rs (line 108)
104fn main() {
105 run(
106 Room::Start,
107 &mut State { has_key: false },
108 &mut CliFrontend::new(),
109 )
110 .command("save", |rt| {
111 match rt.save("rooms.yaml") {
112 Ok(_) => rt.println("Save complete"),
113 Err(e) => rt.println(format!("Error: {}", e)),
114 }
115 Continue
116 })
117 .command("load", |rt| {
118 match rt.load("rooms.yaml") {
119 Ok(_) => rt.println("Load complete"),
120 Err(e) => rt.println(format!("Error: {}", e)),
121 }
122 Skip
123 })
124 .command("inv, inventory", |rt| rt.push_node(Inventory));
125}Sourcepub fn with_bg_color(color: Color) -> Self
pub fn with_bg_color(color: Color) -> Self
Create a new CliFrontend with the given background color
Trait Implementations§
Source§impl Default for CliFrontend
impl Default for CliFrontend
Source§impl Frontend for CliFrontend
impl Frontend for CliFrontend
Source§fn background_color(&self) -> Color
fn background_color(&self) -> Color
Get the background color
Source§fn set_background_color(&mut self, color: Color)
fn set_background_color(&mut self, color: Color)
Set the background color
Source§fn print_colored<S: ToString>(&mut self, text: S, color: Color)
fn print_colored<S: ToString>(&mut self, text: S, color: Color)
Print text to the display with the given color
Auto Trait Implementations§
impl Freeze for CliFrontend
impl RefUnwindSafe for CliFrontend
impl Send for CliFrontend
impl Sync for CliFrontend
impl Unpin for CliFrontend
impl UnwindSafe for CliFrontend
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more