[−][src]Struct gameboard::info::Info
Information area structure.
Methods
impl Info
[src]
pub fn new(size: usize, layout: InfoLayout, lines: &[&str]) -> Self
[src]
Creates new information area.
Arguments
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 g̈ 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.
Examples
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
Blanket Implementations
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From for T
[src]
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,