pub fn new(state: T) -> Self {
        Canvas {
            state: state,
            draw: Box::new(|_, _| ()),
            on_event: Box::new(|_, _| EventResult::Ignored),
            required_size: Box::new(|_, _| Vec2::new(1, 1)),
            layout: Box::new(|_, _| ()),
            take_focus: Box::new(|_, _| false),
            needs_relayout: Box::new(|_| true),
        }
    }
/// Creates a new, empty Canvas.
///
/// # Examples
///
/// ```rust
/// # use cursive::views::Canvas;
/// let canvas = Canvas::new(())
///                     .with_draw(|printer, _| {
///                         // Print the view
///                     });
/// ```
Creates a new, empty Canvas.
Creates a new empty Canvas .
pub fn new(state: T) -> Self {
        Canvas {
            state: state,
            draw: Box::new(|_, _| ()),
            on_event: Box::new(|_, _| EventResult::Ignored),
            required_size: Box::new(|_, _| Vec2::new(1, 1)),
            layout: Box::new(|_, _| ()),
            take_focus: Box::new(|_, _| false),
            needs_relayout: Box::new(|_| true),
        }
    }
pub fn new ( state : T ) -> Self { Canvas { state : state , draw : Box :: new ( | _ , _ | ( ) ) , on_event : Box :: new ( | _ , _ | EventResult :: Ignored ) , required_size : Box :: new ( | _ , _ | Vec2 :: new ( 1 , 1 ) ) , layout : Box :: new ( | _ , _ | ( ) ) , take_focus : Box :: new ( | _ , _ | false ) , needs_relayout : Box :: new ( | _ | true ) , } }
Creates a new, empty Canvas.
Creates a new empty Canvas .
state
T
state
T
examples
None
use cursive::views::canvas;
let canvas = Canvas::new(())
.with_draw(|printer, _| {
Print the view
});
```
let canvas = Canvas :: new (( )) . with_draw ( |printer _| { Print the view } ) ; ` ` `