bordered

Function bordered 

Source
pub fn bordered<L: Layoutable<C>, C: PixelColor, D: Decorator<C>>(
    layoutable: L,
    decorator: D,
) -> impl Layoutable<C>
Expand description

Generate a border around a layouted element

§Arguments

  • layoutable: element within the border
  • decorator: definition of the decorator around that element

returns: impl Layoutable+Sized

§Examples

use embedded_graphics::mono_font::iso_8859_1::FONT_6X12;
use embedded_graphics::mono_font::MonoTextStyle;
use embedded_graphics::pixelcolor::BinaryColor;
use simple_layout::prelude::{bordered, center, DashedLine, owned_text};
let temperature = 20.7;
let element = bordered(
                center(owned_text(format!("{temperature:.1}°C"), MonoTextStyle::new(&FONT_6X12, BinaryColor::On))),
                DashedLine::new(2, 2, BinaryColor::On),
            );