#fields #convert #macro #sharing #structs #serde-json #i32

impl-from-into-similar

为任何具有相似字段的struct实现Into,以在struct之间进行转换。使用serde_json。

4个版本

0.2.1 2023年2月19日
0.2.0 2023年2月19日
0.1.1 2023年2月19日
0.1.0 2023年2月19日

#2016 in 过程宏

每月23次下载

MIT许可证

3KB

由Bing AI生成的说明

impl-from-into-similar

一个Rust crate,它提供了一个宏来为类似类型实现From和Into特质。

安装

将以下内容添加到您的Cargo.toml中

[dependencies] impl-from-into-similar = “0.1.0” 

用法

导入crate并使用impl_from_into_similar!宏与两个或多个具有相似字段的类型

use impl_from_into_similar::impl_from_into_similar;

struct Foo { x: i32, y: i32, }

struct Bar { x: i32, y: i32, }

impl_from_into_similar!(Foo, Bar); 

许可证

本项目采用MIT许可证。

依赖项

~3.5–4.5MB
~88K SLoC