2 个版本

使用旧的 Rust 2015

0.1.1 2017年9月29日
0.1.0 2017年9月29日

#228值格式化

Download history 1575/week @ 2024-03-14 1664/week @ 2024-03-21 1706/week @ 2024-03-28 1508/week @ 2024-04-04 1809/week @ 2024-04-11 2072/week @ 2024-04-18 1822/week @ 2024-04-25 2213/week @ 2024-05-02 3798/week @ 2024-05-09 13485/week @ 2024-05-16 16220/week @ 2024-05-23 27183/week @ 2024-05-30 19625/week @ 2024-06-06 13749/week @ 2024-06-13 7065/week @ 2024-06-20 4459/week @ 2024-06-27

51,825 每月下载量
7 个crate(3 个直接)中使用

Apache-2.0

8KB
145

extfmt

一个提供Rust类型额外格式化选项的crate

使用方法

将依赖项添加到您的 Cargo.toml

[dependencies]
extfmt = "0.1"
extern crate extfmt;

use extfmt::*;

fn main() {
	// Wrapper types for prettier printing of slices.
	//
	// The string is formatted in a "slice" form, and supports most 
	// format specifiers as long as the underlying type implements them
	//
	// This prints "[01, 02, ff, 40]"
	println!("{:02x}", CommaSeparated(&[1, 2, 255, 64]));

	// Compact formatting of byte slices:
	// This prints "0102ff40".
	println!("{}", Hexlify(&[1, 2, 255, 64]));

	// Pretty buffer printing using `hexdump`.
	println!("{}", hexdump!(&[1u8, 2, 255, 64]));
	// 	 => 00000000	01 02 ff 40

	// Hexdump can also be used as a memory view for Sized types.
	println!("{}", hexdump!(64));
	//   => 00000000	40 00 00 00

	// Further hexdump options
	println!("{}", hexdump!(64, show_index: false));
	//   => 40 00 00 00
}

lib.rs:

一个提供某些类型扩展格式化选项的crate。

无运行时依赖