Expand description
Cargo-like printing
Easily print beautiful formatted messages like Cargo does.
§Examples
use cprint::{cprint, Color};
cprint!("Using cprint crate!");
§Coloration
For all signatures, you can specify the color of the title with a predefined color from the colored::Color
enum or with RGB values (r, g, b)
.
To specify the color use =>
at the end of the strings.
§Macros
cprint!
andcprintln!
for printing to stdout.ceprint!
andceprintln!
for printing to stderr.cformat!
for formatting a string.
Macros§
- ceprint
- Print an error message like Cargo does. If you pass only one string, the first word is the title and the rest is the message. If you pass two strings the first one is the title and the second one is the message.
You can specify the color of the title with a predefined color from the
colored::Color
enum or with RGB values(r, g, b)
. To specify the color use=>
after the strings. The end of the title is padded with spaces to make it 12 characters long. - ceprintln
- Same as
ceprint!
but with a newline at the end. - cformat
- Get a string of a message like Cargo does. If you pass only one string, the first word is the title and the rest is the message. If you pass two strings the first one is the title and the second one is the message.
You can specify the color of the title with a predefined color from the
colored::Color
enum or with RGB values(r, g, b)
. To specify the color use=>
after the strings. The end of the title is padded with spaces to make it 12 characters long. - cprint
- Print a message like Cargo does. If you pass only one string, the first word is the title and the rest is the message. If you pass two strings the first one is the title and the second one is the message.
You can specify the color of the title with a predefined color from the
colored::Color
enum or with RGB values(r, g, b)
. To specify the color use=>
after the strings. The end of the title is padded with spaces to make it 12 characters long. - cprintln
- Same as
cprint!
but with a newline at the end.
Enums§
- Color
- The 8 standard colors.
Traits§
- Coloration
- Trait for coloration of text.
Coloration<ColorType>
is the type of the color you want to use. It can be aColor
or aString
.