3 unstable releases

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

#66 in #constructor

Download history 15/week @ 2024-11-13 16/week @ 2024-11-20 23/week @ 2024-11-27 34/week @ 2024-12-04 51/week @ 2024-12-11 15/week @ 2024-12-18 5/week @ 2024-12-25 12/week @ 2025-01-01 18/week @ 2025-01-08 5/week @ 2025-02-05 25/week @ 2025-02-12 23/week @ 2025-02-19 29/week @ 2025-02-26

82 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
~38K SLoC