Crates.io | rust2antd |
lib.rs | rust2antd |
version | 0.1.0 |
source | src |
created_at | 2024-06-30 10:52:08.305556 |
updated_at | 2024-06-30 10:52:08.305556 |
description | Generate Ant Design table from Rust struct |
homepage | |
repository | https://github.com/cody-why/rust2antd |
max_upload_size | |
id | 1287915 |
size | 12,024 |
例如有一个rust struct:
#[derive(Debug, Serialize, Clone)]
pub struct MenuList {
pub id: i32,
pub menu_name: String,
}
转换成antd:
export interface MenuList {
id: number;
menu_name: string;
}
const columns: ColumnsType<MenuList> = [
{
title: t('id'),
dataIndex: 'id',
},
{
title: t('menu_name'),
dataIndex: 'menu_name',
},
]
安装 rust2antd:
cargo install rust2antd
然后在 rust 项目的struct的目录下运行:
rust2antd
或者指定输入文件:
rust2antd <input_file>
其中 <input_file>
是 rust struct 的路径, 例如 src/vo/vo.rs