Trait moto::Printable

source ·
pub trait Printable {
    // Required methods
    fn print<F>(&self, func: F)
       where F: Fn(&str) -> String;
    fn println<F>(&self, func: F)
       where F: Fn(&str) -> String;
    fn print_positioned<F>(&self, x: i32, y: i32, func: F)
       where F: Fn(&str) -> String;
}
Expand description

§Printable

supports calling print, write, render and style on any type e.g. "hello".print(|s| in_red(s))

Required Methods§

source

fn print<F>(&self, func: F)
where F: Fn(&str) -> String,

print the text

source

fn println<F>(&self, func: F)
where F: Fn(&str) -> String,

print the text with a newline

source

fn print_positioned<F>(&self, x: i32, y: i32, func: F)
where F: Fn(&str) -> String,

print_in_postion print the text in a specific position e.g. “hello”.print_in_position(-3,4,|s| in_red(s)) prints “hello” 3 lines up and 4 characters to the right

Object Safety§

This trait is not object safe.

Implementors§

source§

impl<T> Printable for T
where T: Display,