Skip to main content

cluColor

Trait cluColor 

Source
pub trait cluColor:
    Debug
    + Display
    + Eq
    + Hash
    + Ord
    + PartialEq
    + PartialOrd {
Show 21 methods // Required methods fn raw_color<'a>() -> &'a str; fn raw_color_b<'a>() -> &'a [u8] ; fn name<'a>() -> &'a str; // Provided methods fn writer() -> cluColorWriter<Self> where Self: Sized { ... } fn string_as<'a, A: AsRef<str>>(asref: A) -> String { ... } fn stringn_as<'a, A: AsRef<str>>(asref: A) -> String { ... } fn string_fmt<'a>(fmt: Arguments<'a>) -> String { ... } fn string<'a>(str: &'a str) -> String { ... } fn stringn<'a>(str: &'a str) -> String { ... } fn stringn_fmt<'a>(fmt: Arguments<'a>) -> String { ... } fn write_as<'a, W: Write, A: AsRef<[u8]>>(w: W, asref: A) -> Result<()> { ... } fn writen_as<'a, W: Write, A: AsRef<[u8]>>(w: W, asref: A) -> Result<()> { ... } fn write<'a, W: Write>(w: W, array: &'a [u8]) -> Result<()> { ... } fn write_str<'a, W: Write>(w: W, str: &'a str) -> Result<()> { ... } fn write_fmt<'a, W: Write>(w: W, fmt: Arguments<'a>) -> Result<()> { ... } fn writen<'a, W: Write>(w: W, array: &'a [u8]) -> Result<()> { ... } fn writen_str<'a, W: Write>(w: W, str: &'a str) -> Result<()> { ... } fn writen_fmt<'a, W: Write>(w: W, fmt: Arguments<'a>) -> Result<()> { ... } fn with_color_fmt<'a, F: Fn(&Arguments<'_>) -> T, T: 'a>( args: Arguments<'a>, function: F, ) -> T { ... } fn once_with_color_fmt<'a, F: FnOnce(&Arguments<'_>) -> T, T: 'a>( args: Arguments<'a>, function: F, ) -> T { ... } fn mut_with_color_fmt<'a, F: FnMut(&Arguments<'_>) -> T, T: 'a>( args: Arguments<'a>, function: F, ) -> T { ... }
}
Expand description

Common features implemented by the generalized type.

Required Methods§

Source

fn raw_color<'a>() -> &'a str

Color str type

Source

fn raw_color_b<'a>() -> &'a [u8]

Color array type

Source

fn name<'a>() -> &'a str

Name color

Provided Methods§

Source

fn writer() -> cluColorWriter<Self>
where Self: Sized,

Examples found in repository?
examples/use_write_slice.rs (line 14)
8fn main() {
9	
10	let time_start = SystemTime::now();
11	println!("Start time {:?} nanos", time_start.elapsed().unwrap().subsec_nanos());
12	
13
14	let writer = BrightRed::writer();
15
16	println!("#1 {}", test(&writer, "Test"));
17	println!("#2 {}", test(&writer, "Test2"));
18	println!("#3 {}", test(writer, "Test move"));
19}
More examples
Hide additional examples
examples/use_write.rs (line 20)
9fn main() {
10	{//macros write
11
12		let stdout = ::std::io::stdout();
13		let mut lock_stdio = stdout.lock();
14	
15		write_color!(&mut lock_stdio, BrightBlue, "{} {} macro write...", 12345, "str");
16		write_color!(lock_stdio, BrightBlue, "{} {} macro write...", 123465, "str");
17	}
18	
19	{//write struct
20		let writer = Blue::writer();
21	
22		let stdout = ::std::io::stdout();
23		let mut lock_stdio = stdout.lock();
24	
25		writer.writen(&mut lock_stdio, b"TestWriten").unwrap();
26
27	}
28
29	{//macros writen
30
31		writen_color!(&mut ::std::io::stdout(), BrightBlue, "{} {}", 123, "str");
32		//mut 
33
34		writen_color!(::std::io::stdout(), BrightBlue, "{} {}", 12345, "str");
35		//move mut
36	}
37}
Source

fn string_as<'a, A: AsRef<str>>(asref: A) -> String

Source

fn stringn_as<'a, A: AsRef<str>>(asref: A) -> String

Source

fn string_fmt<'a>(fmt: Arguments<'a>) -> String

Examples found in repository?
examples/struct.rs (line 38)
37	pub fn string<'a>(&self, str: &'a str) -> String {
38		C::string_fmt( format_args!("[{:?} nanos] {}", SystemTime::now().elapsed().unwrap().subsec_nanos(), str) )
39	}
More examples
Hide additional examples
examples/use_write_slice.rs (line 22)
21fn test<C: cluColor>(_c: C, str: &str) -> String {
22     C::string_fmt( format_args!("[{:?} nanos] {}", SystemTime::now().elapsed().unwrap().subsec_nanos(), str) )
23}
examples/struct_2.rs (line 35)
34	pub fn string<'a>(&self, str: &'a str) -> String {
35		BrightRed::string_fmt( format_args!("[{:?} nanos] {}", SystemTime::now().elapsed().unwrap().subsec_nanos(), str) )
36	}
Source

fn string<'a>(str: &'a str) -> String

Source

fn stringn<'a>(str: &'a str) -> String

Source

fn stringn_fmt<'a>(fmt: Arguments<'a>) -> String

Source

fn write_as<'a, W: Write, A: AsRef<[u8]>>(w: W, asref: A) -> Result<()>

Source

fn writen_as<'a, W: Write, A: AsRef<[u8]>>(w: W, asref: A) -> Result<()>

Source

fn write<'a, W: Write>(w: W, array: &'a [u8]) -> Result<()>

Source

fn write_str<'a, W: Write>(w: W, str: &'a str) -> Result<()>

Source

fn write_fmt<'a, W: Write>(w: W, fmt: Arguments<'a>) -> Result<()>

Source

fn writen<'a, W: Write>(w: W, array: &'a [u8]) -> Result<()>

Source

fn writen_str<'a, W: Write>(w: W, str: &'a str) -> Result<()>

Source

fn writen_fmt<'a, W: Write>(w: W, fmt: Arguments<'a>) -> Result<()>

Source

fn with_color_fmt<'a, F: Fn(&Arguments<'_>) -> T, T: 'a>( args: Arguments<'a>, function: F, ) -> T

Examples found in repository?
examples/with_color.rs (lines 14-16)
8pub fn main() {
9	//Experimental possibility of using Rust Arguments for cluColors.
10
11     let mut item = Items::default();
12
13     for a in 0..15 {
14          BrightBlue::with_color_fmt(format_args!("ITEM #{:?}", item), |fmt| {
15               println!("NUM #{}, {}; COUNT: {}", a, fmt, item.count());
16          });
17          
18          item.0 += 1;
19          item.1 += 2;
20     }
21
22
23     for a in 0..15 {
24          BrightGreen::with_color_fmt(format_args!("NUM #{}", a), |fmt_num| {
25               BrightBlue::with_color_fmt(format_args!("ITEM #{:?}", item), |fmt_item| {
26                    BrightRed::with_color_fmt(format_args!("ALL_COUNT {}", item.count()), |fmt_count| {
27                         println!("{}, {}; {};", fmt_num, fmt_item, fmt_count);
28                    });
29               });
30          });
31
32          item.0 += 1;
33          item.1 += 2;
34     }
35}
Source

fn once_with_color_fmt<'a, F: FnOnce(&Arguments<'_>) -> T, T: 'a>( args: Arguments<'a>, function: F, ) -> T

Source

fn mut_with_color_fmt<'a, F: FnMut(&Arguments<'_>) -> T, T: 'a>( args: Arguments<'a>, function: F, ) -> T

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl<'l, T: cluColor> cluColor for &'l T

Source§

fn raw_color<'a>() -> &'a str

Source§

fn raw_color_b<'a>() -> &'a [u8]

Source§

fn name<'a>() -> &'a str

Source§

fn writer() -> cluColorWriter<Self>
where Self: Sized,

Source§

fn string_as<'a, A: AsRef<str>>(asref: A) -> String

Source§

fn stringn_as<'a, A: AsRef<str>>(asref: A) -> String

Source§

fn string_fmt<'a>(fmt: Arguments<'a>) -> String

Source§

fn string<'a>(str: &'a str) -> String

Source§

fn stringn<'a>(str: &'a str) -> String

Source§

fn stringn_fmt<'a>(fmt: Arguments<'a>) -> String

Source§

fn write_as<'a, W: Write, A: AsRef<[u8]>>(w: W, asref: A) -> Result<()>

Source§

fn writen_as<'a, W: Write, A: AsRef<[u8]>>(w: W, asref: A) -> Result<()>

Source§

fn write<'a, W: Write>(w: W, array: &'a [u8]) -> Result<()>

Source§

fn write_str<'a, W: Write>(w: W, str: &'a str) -> Result<()>

Source§

fn write_fmt<'a, W: Write>(w: W, fmt: Arguments<'a>) -> Result<()>

Source§

fn writen<'a, W: Write>(w: W, array: &'a [u8]) -> Result<()>

Source§

fn writen_str<'a, W: Write>(w: W, str: &'a str) -> Result<()>

Source§

fn writen_fmt<'a, W: Write>(w: W, fmt: Arguments<'a>) -> Result<()>

Source§

fn with_color_fmt<'a, F: Fn(&Arguments<'_>) -> C, C: 'a>( args: Arguments<'a>, function: F, ) -> C

Source§

fn once_with_color_fmt<'a, F: FnOnce(&Arguments<'_>) -> C, C: 'a>( args: Arguments<'a>, function: F, ) -> C

Source§

fn mut_with_color_fmt<'a, F: FnMut(&Arguments<'_>) -> C, C: 'a>( args: Arguments<'a>, function: F, ) -> C

Source§

impl<'l, T: cluColor> cluColor for &'l mut T

Source§

fn raw_color<'a>() -> &'a str

Source§

fn raw_color_b<'a>() -> &'a [u8]

Source§

fn name<'a>() -> &'a str

Source§

fn writer() -> cluColorWriter<Self>
where Self: Sized,

Source§

fn string_as<'a, A: AsRef<str>>(asref: A) -> String

Source§

fn stringn_as<'a, A: AsRef<str>>(asref: A) -> String

Source§

fn string_fmt<'a>(fmt: Arguments<'a>) -> String

Source§

fn string<'a>(str: &'a str) -> String

Source§

fn stringn<'a>(str: &'a str) -> String

Source§

fn stringn_fmt<'a>(fmt: Arguments<'a>) -> String

Source§

fn write_as<'a, W: Write, A: AsRef<[u8]>>(w: W, asref: A) -> Result<()>

Source§

fn writen_as<'a, W: Write, A: AsRef<[u8]>>(w: W, asref: A) -> Result<()>

Source§

fn write<'a, W: Write>(w: W, array: &'a [u8]) -> Result<()>

Source§

fn write_str<'a, W: Write>(w: W, str: &'a str) -> Result<()>

Source§

fn write_fmt<'a, W: Write>(w: W, fmt: Arguments<'a>) -> Result<()>

Source§

fn writen<'a, W: Write>(w: W, array: &'a [u8]) -> Result<()>

Source§

fn writen_str<'a, W: Write>(w: W, str: &'a str) -> Result<()>

Source§

fn writen_fmt<'a, W: Write>(w: W, fmt: Arguments<'a>) -> Result<()>

Source§

fn with_color_fmt<'a, F: Fn(&Arguments<'_>) -> C, C: 'a>( args: Arguments<'a>, function: F, ) -> C

Source§

fn once_with_color_fmt<'a, F: FnOnce(&Arguments<'_>) -> C, C: 'a>( args: Arguments<'a>, function: F, ) -> C

Source§

fn mut_with_color_fmt<'a, F: FnMut(&Arguments<'_>) -> C, C: 'a>( args: Arguments<'a>, function: F, ) -> C

Implementors§