3 unstable releases

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

#71 in #named

Download history 11/week @ 2024-01-15 13/week @ 2024-02-05 23/week @ 2024-02-12 19/week @ 2024-02-19 87/week @ 2024-02-26 32/week @ 2024-03-04 24/week @ 2024-03-11 32/week @ 2024-03-18 52/week @ 2024-03-25 72/week @ 2024-04-01 16/week @ 2024-04-08 21/week @ 2024-04-15 23/week @ 2024-04-22 45/week @ 2024-04-29

113 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