pub fn print<S: Into<Vec2>>(&self, pos: S, text: &str) {
        self.new.set(false);

        let p = pos.into();
        if p.y >= self.size.y || p.x >= self.size.x {
            return;
        }
        // Do we have enough room for the entire line?
        let room = self.size.x - p.x;
        // We want the number of CHARACTERS, not bytes.
        // (Actually we want the "width" of the string, see unicode-width)
        let prefix_len = prefix(text.graphemes(true), room, "").length;
        let text = &text[..prefix_len];

        let p = p + self.offset;
        self.backend.print_at((p.x, p.y), text);
    }
// TODO: use &mut self? We don't *need* it, but it may make sense.
// We don't want people to start calling prints in parallel?
/// Prints some text at the given position relative to the window.
use &mut self. We don't *need* it, but it may make sense.
We don't want people to start calling prints in parallel.
Prints some text at the given position relative to the window.
use &mut self . We don ' t * need * it but it may make sense . We don ' t want people to start calling prints in parallel . Prints some text at the given position relative to the window .
pub fn print<S: Into<Vec2>>(&self, pos: S, text: &str) {
        self.new.set(false);
        let p = pos.into();
        if p.y >= self.size.y || p.x >= self.size.x {
            return;
        }
        // Do we have enough room for the entire line?
        let room = self.size.x - p.x;
        // We want the number of CHARACTERS, not bytes.
        // (Actually we want the "width" of the string, see unicode-width)
        let prefix_len = prefix(text.graphemes(true), room, "").length;
        let text = &text[..prefix_len];
        let p = p + self.offset;
        self.backend.print_at((p.x, p.y), text);
    }
pub fn print < S : Into < Vec2 > > ( & self , pos : S , text : & str ) { self . new . set ( false ) ; let p = pos . into ( ) ; if p . y >= self . size . y || p . x >= self . size . x { return ; } // Do we have enough room for the entire line? let room = self . size . x - p . x ; // We want the number of CHARACTERS, not bytes. // (Actually we want the "width" of the string, see unicode-width) let prefix_len = prefix ( text . graphemes ( true ) , room , " " ) . length ; let text = & text [ .. prefix_len ] ; let p = p + self . offset ; self . backend . print_at ( ( p . x , p . y ) , text ) ; }
TODO: use &mut self?
TODO : use &mut self?
&self
pos
S
text
&str
&self
pos
S
text
&str