[−][src]Struct idioma::Text
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]
I: Display,
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
Auto Trait Implementations
impl RefUnwindSafe for Text
[src]
impl Send for Text
[src]
impl Sync for Text
[src]
impl Unpin for Text
[src]
impl UnwindSafe for Text
[src]
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,
pub 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> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
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.
pub 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>,