Post

A lot of new features have been added to the `#[cgp_getter]` macro! For the basic use cases, you can now define getter methods that return &str or Option<&T>, and the macro will generate getter implementations that read from String or Option<T> fields. github.com/contextgener...

github.comRefactoring and Improvements on `#[cgp_getter]` by soareschen · Pull Request #81 · contextgeneric/cgpSummary This PR brings several quality of life improvements on the proc macros #[cgp_getter] and #[cgp_auto_getter], allowing them to support more general getter interfaces to be defined. Specializ...

1 repost0 likes

This mainly improves use of CGP with idiomatic Rust code. Apparently, some readers pointed out about the aesthetic of getter methods returning &String instead of &str. This especially affects first impressions, when the hello world of CGP demonstrates the dependency injection of string fields.

There are also many other advanced improvements, such as allowing PhantomData tags and generic implementation of field accessors using AsRef. The PR covers high level overview of all changes. For detailed walk through, stay tuned for more blog posts and updates on the book.