2个版本

0.1.1 2019年6月9日
0.1.0 2019年6月9日

#2360 in 数据结构

自定义许可

53KB
949

lhlist

Build Status Documentation

lhlist 是一个用于 Labeled Hetergogeneous List 的库。

此库提供创建和访问具有唯一标签的不同类型对象的列表的数据结构和宏。

有关更多详细信息,请参阅文档

用法

lhlist 添加到您的 Cargo.toml

[dependencies]
lhlist = "0.1"

然后可以这样使用它

#[macro_use] extern crate lhlist;

use lhlist::Label;

new_label![SomeNumbers: Vec<u64>];
new_label![SomeNames: Vec<&'static str>];
new_label![Flag: bool];

let my_list = lhlist![
    SomeNumbers = vec![0, 4, 5, 2],
    SomeNames = vec!["hello", "world!"],
    Flag = false,
];

assert_eq!(my_list[SomeNumbers], vec![0, 4, 5, 2]);
assert_eq!(my_list[Flag], false);

许可

本项目采用 MIT许可

依赖项

~420–690KB
~17K SLoC