[][src]Struct gameboard::info::Info

pub struct Info { /* fields omitted */ }

Information area structure.


impl Info[src]

pub fn new(size: usize, layout: InfoLayout, lines: &[&str]) -> Self[src]

Creates new information area.


size - information area size in characters. You need to set one dimension size only. Another one will be taken from the board. For example, if layout is InfoLayout::Left then info area will be at the left of the board and have the same height. size will be a width of the info area.

layout - information area layout

lines - information area content. A list of strings to display. If line number is more than information area height, last lines will be ignored. Too long lines will be truncated. If you want space between lines, add empty string to list.

Implementation note

This crate iterates Unicode strings as a set of grapheme clusters to handle characters like correctly. When we slice strings to put them inside cells or dialogs, we expect characters to have the same width. This is not always true for some Unicode symbols. Such symbols will break layout.


Information area is above the board. It has height 15 and width the same as a board.

let board = Board::new(5, 5, 10, 5, true, None);
let info = Info::new(15, InfoLayout::Top, &[
    "This is line 1.",
    "This is line 3.",
    "This is line 4.",

Auto Trait Implementations

impl Send for Info

impl Sync for Info

Blanket Implementations

impl<T, U> Into for T where
    U: From<T>, 

impl<T> From for T[src]

impl<T, U> TryFrom for T where
    U: Into<T>, 

type Error = Infallible

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized

impl<T> BorrowMut for T where
    T: ?Sized

impl<T, U> TryInto for T where
    U: TryFrom<T>, 

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Any for T where
    T: 'static + ?Sized