pi_print_any 0.1.2

print any value without trait bounds using specialization (Rust nightly channel)
Documentation
  • Coverage
  • 100%
    6 out of 6 items documented6 out of 6 items with examples
  • Size
  • Source code size: 5.57 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 1.49 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 10s Average build duration of successful builds.
  • all releases: 10s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • GaiaWorld/pi_print_any
    1 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • wzjsun github:gaiaworld:dev

output without the trait bounds (using specialization to find the right impl anyway)

output value for type of impl Debug, output type name for unimplDebug.

for example:

	#[derive(Debug)]
	struct A(usize);
	struct B(usize);
	fn main() {
		println_any!("{:?}", A(1)); // output: A(1)
		println_any!("{:?}", B(1)); // output: `pi_print_any::B`

		print_any!("{:?}", A(1)); // output: A(1)
		print_any!("{:?}", B(1)); // output: `pi_print_any::B`
	}

In addition to using print and println output, you can also use other macros to output, out_any allows you to pass in the output macro you want to use

for example:

	#[derive(Debug)]
	struct A(usize);
	struct B(usize);
	fn main() {
		out_any!(log::info, "{:?}", A(1)); // output: A(1)
		out_any!(log::info, "{:?}", B(1)); // output: `pi_print_any::B`
	}