| Crates.io | getter-methods |
| lib.rs | getter-methods |
| version | 2.0.2 |
| created_at | 2023-09-19 21:29:12.849472+00 |
| updated_at | 2025-06-18 22:36:33.581059+00 |
| description | Derive macro to create getter / accessor methods. |
| homepage | |
| repository | https://github.com/lukesneeringer/getter-methods |
| max_upload_size | |
| id | 977250 |
| size | 23,626 |
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.