[−][src]Struct boxx::Boxx
Boxx
is a customizable data structure that will pretty print content
separated by newlines (\n
).
Fields
config: Config
Display configuration of the Boxx
. This field dictates how a Boxx
will
be displayed in the terminal.
Methods
impl Boxx
[src]
pub fn default() -> Boxx
[src]
pub fn new(config: Config) -> Boxx
[src]
Creates a new Boxx
from a pre-made Config
.
Example
use boxx::{Boxx, Config}; let config = Config::default(); let boxx = Boxx::new(config);
pub fn builder() -> Config
[src]
Get a configuration builder to customize the appearance of a Boxx
.
Example
use boxx::Boxx; let boxx = Boxx::builder().padding(3).margin(1).build();
pub fn display(&self, content: &str)
[src]
Prints your Boxx
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.
If you would like to handle specific error cases, it is recommended to use
.as_str()
directly.
Example
use boxx::Boxx; Boxx::default().display("Hello, World!\nNew lines can be created with the newline separator :).");
pub fn as_str(&self, content: &str) -> Result<String, VisualWidthError>
[src]
Get your content in a Boxx
as a String
.
Example
use boxx::Boxx; let result = Boxx::default().as_str("Hello, World!")?; println!("{}", result);
Trait Implementations
impl Clone for Boxx
[src]
impl Debug for Boxx
[src]
impl PartialEq<Boxx> for Boxx
[src]
impl StructuralPartialEq for Boxx
[src]
Auto Trait Implementations
impl RefUnwindSafe for Boxx
impl Send for Boxx
impl Sync for Boxx
impl Unpin for Boxx
impl UnwindSafe for Boxx
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> 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, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,