/// Draw a window frame with an optional title.
///
/// Draws a rectangle (using the rect method) using the suplied background
/// flag, then draws a rectangle with the console's default foreground
/// colour.
///
/// If the `title` is specified, it will be printed on top of the rectangle
/// using inverted colours.
Draw a window frame with an optional title.
Draws a rectangle (using the rect method) using the suplied background
flag, then draws a rectangle with the console's default foreground
colour.

If the `title` is specified, it will be printed on top of the rectangle
using inverted colours.
Draw a window frame with an optional title . Draws a rectangle ( using the rect method ) using the suplied background flag then draws a rectangle with the console ' s default foreground colour . If the ` title ` is specified it will be printed on top of the rectangle using inverted colours .
fn print_frame<T>(&mut self, x: i32, y: i32, width: i32, height: i32,
                     clear: bool, background_flag: BackgroundFlag, title: Option<T>) where Self: Sized, T: AsRef<str> {
        assert!(x >= 0 && y >= 0 && width >= 0 && height >= 0);
        assert!(x + width <= self.width() && y + height <= self.height());
        // NOTE: we need to run `CString::new` and `as_ptr` in two
        // separate steps. If we did it all at once, the `CString`
        // would get dropped too early and we'd get a dangling
        // pointer.
        let title = title.map(|s| {
                assert!(s.as_ref().is_ascii());
                CString::new(s.as_ref().as_bytes()).unwrap()
        });
        // NOTE: `map_or` takes the option by value, which would cause
        // a premature drop again. The `as_ref` here prevents that
        // from happening.
        let c_title = title.as_ref().map_or(ptr::null(), |s| s.as_ptr());
        unsafe {
            ffi::TCOD_console_print_frame(*self.as_native(), x, y, width, height,
                                          clear as c_bool, background_flag.into(),
                                          c_title);
        }
    }
fn print_frame < T > ( & mut self , x : i32 , y : i32 , width : i32 , height : i32 , clear : bool , background_flag : BackgroundFlag , title : Option < T > ) where Self : Sized , T : AsRef < str > { assert ! ( x 0 y 0 width 0 height 0 ) ; assert ! ( x width self width ( ) y height self height ( ) ) ; // NOTE: we need to run `CString::new` and `as_ptr` in two // separate steps. If we did it all at once, the `CString` // would get dropped too early and we'd get a dangling // pointer. let title = title . map ( | s | { assert ! ( s as_ref ( ) is_ascii ( ) ) ; CString :: new ( s . as_ref ( ) . as_bytes ( ) ) . unwrap ( ) } ) ; // NOTE: `map_or` takes the option by value, which would cause // a premature drop again. The `as_ref` here prevents that // from happening. let c_title = title . as_ref ( ) . map_or ( ptr :: null ( ) , | s | s . as_ptr ( ) ) ; unsafe { ffi :: TCOD_console_print_frame ( * self . as_native ( ) , x , y , width , height , clear as c_bool , background_flag . into ( ) , c_title ) ; } }
Draw a window frame with an optional title.
Draw a window frame with an optional title .
&mut self
x
i32
y
i32
width
i32
height
i32
clear
bool
background_flag
BackgroundFlag
title
Option<T>