[][src]Struct idioma::Text

pub struct Text { /* fields omitted */ }

Text is the main type that gets thrown around between functions and methods. It is basically a String, but it had to be made into a separate struct so that it would be possible to impl some things for it.

Implementations

impl Text[src]

pub fn make<I>(label: ColoredString, message: I) -> Self where
    I: Display
[src]

Returns Text by constructing it from a given label and message.

Examples

use idioma::*;
use colored::*;
Text::make("lol".cyan().bold(), "LMAO you're so funny.");

pub fn print(&self)[src]

Displays Text thanks to the std::fmt::Display trait.

Examples

use idioma::*;
warning("This message is going to be printed out immediately!").print();

pub fn exit(self, code: i32) -> Self[src]

Displays message and terminates the program via std::process::exit. Please note that this function returns Text back in case we need to please the type checker. See exit_if_error function for an example of that.

Examples

use idioma::*;
error("You were not supposed to mess with me!").exit(1);

You can even combine custom and exit to produce some real nice stuff.

use idioma::*;
use colored::*;
custom("lol".cyan().bold())("Did you expect something serious here? LMAO XD").exit(1);

Trait Implementations

impl Debug for Text[src]

impl Display for Text[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> ToString for T where
    T: Display + ?Sized
[src]

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.