splat_derive

Crates.iosplat_derive
lib.rssplat_derive
version0.1.1
sourcesrc
created_at2024-01-14 12:00:11.870963
updated_at2024-01-14 23:56:27.063933
descriptionA crate providing a Splat derive macro, which generates a splat method for the struct deriving it.
homepage
repositoryhttps://github.com/bread42/splat_derive
max_upload_size
id1099383
size7,070
Bread (bread42)

documentation

README

About

This is a crate providing a Splat derive macro, which generates a splat method for the struct deriving it.

The splat method

The splat method is commonly defined for structs with numeric fields of the same type. It takes a value v and returns an instance of the struct where each field is set to 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.

Usage

Add the following to your Cargo.toml

[dependencies]
splat_derive = "0.1.0"
Commit count: 0

cargo fmt