3 unstable releases

0.2.0 Jan 29, 2022
0.1.1 Dec 11, 2021
0.1.0 Dec 11, 2021

#74 in #named

Download history 12/week @ 2023-12-15 15/week @ 2023-12-22 1/week @ 2023-12-29 6/week @ 2024-01-05 12/week @ 2024-01-12 5/week @ 2024-01-19 9/week @ 2024-02-02 16/week @ 2024-02-09 26/week @ 2024-02-16 58/week @ 2024-02-23 48/week @ 2024-03-01 32/week @ 2024-03-08 27/week @ 2024-03-15 43/week @ 2024-03-22 56/week @ 2024-03-29

160 downloads per month
Used in 10 crates (7 directly)

BSD-3-Clause

5KB
60 lines

Records

Records is a Rust library which adds an attribute designed for simple data classes ("records").

What is a record?

The record attribute takes a standard named struct and

  1. Makes all it's fields pub
  2. Gives it a constructor
  3. Implements convesrsion to/from tuples

Example

#[records::record]
pub struct Person {
  name: String,
}

pub fn main() {
  let person = Person::new(String::from("World"));
  println!("Hello, {}!", person.name);
}

lib.rs:

Procedral macro for data classes (records)

Dependencies

~1.5MB
~33K SLoC