fn draw(&self, canvas: &mut dyn Canvas) -> Result<()> {
        let (width, height) = canvas.size()?;
        let outer_rect = Rectangle {
            top: 0,
            left: 0,
            width,
            height,
        };

        let rect_in_margin = self.rect_reserve_margin(outer_rect)?;
        self.draw_border(rect_in_margin, canvas)?;

        let Rectangle {
            top,
            left,
            width,
            height,
        } = self.calc_inner_rect(outer_rect)?;

        let mut new_canvas = BoundedCanvas::new(top, left, width, height, canvas);
        self.inner.draw(&mut new_canvas)
    }
/// Reserve margin & padding, draw border.
Reserve margin & padding, draw border.
Reserve margin & padding draw border .
fn draw(&self, canvas: &mut dyn Canvas) -> Result<()> {
        let (width, height) = canvas.size()?;
        let outer_rect = Rectangle {
            top: 0,
            left: 0,
            width,
            height,
        };
        let rect_in_margin = self.rect_reserve_margin(outer_rect)?;
        self.draw_border(rect_in_margin, canvas)?;
        let Rectangle {
            top,
            left,
            width,
            height,
        } = self.calc_inner_rect(outer_rect)?;
        let mut new_canvas = BoundedCanvas::new(top, left, width, height, canvas);
        self.inner.draw(&mut new_canvas)
    }
fn draw ( & self , canvas : & mut dyn Canvas ) -> Result < ( ) > { let ( width , height ) = canvas . size ( ) ? ; let outer_rect = Rectangle { top : 0 , left : 0 , width , height , } ; let rect_in_margin = self . rect_reserve_margin ( outer_rect ) ? ; self . draw_border ( rect_in_margin , canvas ) ? ; let Rectangle { top , left , width , height , } = self . calc_inner_rect ( outer_rect ) ? ; let mut new_canvas = BoundedCanvas :: new ( top , left , width , height , canvas ) ; self . inner . draw ( & mut new_canvas ) }
Reserve margin & padding, draw border.
Reserve margin & padding draw border .
&self
canvas
&mut dyn Canvas
&self
canvas
&mut dyn Canvas