lemmy icon indicating copy to clipboard operation
lemmy copied to clipboard

Use `derive_aliases` and `cfg_aliases`

Open Nutomic opened this issue 2 months ago • 2 comments

https://github.com/nik-rev/derive-aliases

This could simplify a lot of our struct definitions from this:

#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]
#[cfg_attr(
  feature = "full",
  derive(Queryable, Selectable, Associations, Identifiable, CursorKeysModule)
)]
...

To this:

#[derive(..ApiStruct)]
#[cfg_attr(feature = "full", derive(..SqlStruct))]
...

Nutomic avatar Oct 22 '25 11:10 Nutomic

Nice, I like that a lot.

dessalines avatar Oct 22 '25 23:10 dessalines

https://crates.io/crates/cfg_aliases could also be useful.

Nutomic avatar Nov 18 '25 13:11 Nutomic