getter-methods

Crates.iogetter-methods
lib.rsgetter-methods
version1.1.0
sourcesrc
created_at2023-09-19 21:29:12.849472
updated_at2024-05-30 23:04:09.722842
descriptionDerive macro to create getter / accessor methods.
homepage
repositoryhttps://github.com/lukesneeringer/getter-methods
max_upload_size
id977250
size11,284
Luke Sneeringer (lukesneeringer)

documentation

README

getter-methods

ci docs license

This is getter-methods, a derive macro that will generate an impl with accessor methods for each field on the struct.

Using getter-methods is straightforward: simply derive it:

use getter_methods::GetterMethods;

#[derive(GetterMethods)]
struct Foo {
  bar: String,
  baz: i64,
}

let foo = Foo { bar: "bacon".into(), baz: 42 };
assert_eq!(foo.bar(), "bacon");
assert_eq!(foo.baz(), 42);

For more, see the documentation.

Commit count: 8

cargo fmt