2个版本
| 0.1.1 | 2024年1月14日 |
|---|---|
| 0.1.0 | 2024年1月14日 |
在 过程宏 中排名 868
7KB
51 行
关于
这是一个提供Splat derive宏的crate,它为派生它的结构体生成splat方法。
splat 方法
splat 方法通常用于具有相同类型的数值字段的结构的定义。它接受一个值 v 并返回一个将每个字段设置为 v 的结构体实例。
此crate提供了一个宏,为任何具有相同类型字段的任何结构体生成一个 splat 方法。但是,共享的字段类型必须实现 [Clone]。
用法
将以下内容添加到您的Cargo.toml中
[dependencies]
splat_derive = "0.1.0"
lib.rs:
A crate providing a [Splat] derive macro, which generates a splat method for the struct deriving it.
splat 方法
splat 方法通常用于具有相同类型的数值字段的结构的定义。它接受一个值 v 并返回一个将每个字段设置为 v 的结构体实例。
This crate provides a macro that generates a splat method for any struct that has fields which are all of the same type. However, the type shared by each field must implement [Clone].
依赖项
~290–750KB
~18K SLoC