[][src]Struct billboard::Billboard

pub struct Billboard {
    pub config: Config,
}

Billboard is a customizable data structure that will pretty print content separated by newlines (\n).

Fields

config: Config

Display configuration of the Billboard. This field dictates how a Billboard will be displayed in the terminal.

Methods

impl Billboard[src]

pub fn default() -> Billboard[src]

Create a Billboard with deafult configuration.

Example

use billboard::Billboard;

let billboard = Billboard::default();

pub fn new(config: Config) -> Billboard[src]

Creates a new Billboard from a pre-made Config.

Example

use billboard::{Billboard, Config};

let config = Config::default();
let billboard = Billboard::new(config);

pub fn builder() -> Config[src]

Get a configuration builder to customize the appearance of a Billboard.

Example

use billboard::Billboard;

let billboard = Billboard::builder().padding(3).margin(1).build();

pub fn display(&self, content: &str)[src]

Prints your Billboarded content to stdout If your content is long, separate it with line breaks (\n).

If the user's terminal is too small, or something goes wrong with displaying your content in a box, this function will print the content passed to it with no modifications.

If you would like to handle specific error cases, it is recommended to use .as_str() directly.

Example

use billboard::Billboard;

Billboard::default().display("Hello, World!\nNew lines can be created with the newline separator :).");

pub fn as_str(&self, content: &str) -> String[src]

Get your content in a Billboard as a String.

Example

use billboard::Billboard;

let result = Billboard::default().as_str("Hello, World!")?;
println!("{}", result);

Trait Implementations

impl Clone for Billboard[src]

impl Debug for Billboard[src]

impl PartialEq<Billboard> for Billboard[src]

impl StructuralPartialEq for Billboard[src]

Auto Trait Implementations

Blanket Implementations

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

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.