pub struct Billboard {
pub config: Config,
}
Expand description
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.
Implementations
sourceimpl Billboard
impl Billboard
sourcepub fn default() -> Billboard
pub fn default() -> Billboard
Create a Billboard
with default configuration.
Example
use billboard::Billboard;
let billboard = Billboard::default();
sourcepub fn new(config: Config) -> Billboard
pub fn new(config: Config) -> Billboard
Creates a new Billboard
from a pre-made Config
.
Example
use billboard::{Billboard, Config};
let config = Config::default();
let billboard = Billboard::new(config);
sourcepub fn builder() -> Config
pub fn builder() -> Config
Get a configuration builder to customize the appearance of a Billboard
.
Example
use billboard::Billboard;
let billboard = Billboard::builder().padding(3).margin(1).build();
sourcepub fn print(&self, content: impl Display)
pub fn print(&self, content: impl Display)
Prints your Billboard
ed 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.
Example
use billboard::Billboard;
Billboard::default().print("Hello, World!\nNew lines can be created with the newline separator :).");
sourcepub fn eprint(&self, content: impl Display)
pub fn eprint(&self, content: impl Display)
Prints your Billboard
ed content to stderr
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.
Example
use billboard::Billboard;
Billboard::default().eprint("Hello, World!\nNew lines can be created with the newline separator :).");