inter-struct icon indicating copy to clipboard operation
inter-struct copied to clipboard

Field Attributes

Open Nukesor opened this issue 2 years ago • 0 comments

For more control about which fields should be used by InterStruct or in which way they should be used, field attributes will be added.

The idea is to have serde-like configuration pattern. I.e.:

struct SomeStruct {
    #[inter_struct(rename="something_else", unchecked)]
    something: String,
}

For now several options are planned:

  • [ ] unchecked InterStruct does some naive type checking by simply comparing the two types tokens. If the user is sure that the types are identical, unchecked will disable all of InterStruct's type checking.
  • [ ] rename="OtherName" This allows to map a field to a differently named field on the target struct.
  • [ ] ignore InterStruct will completely ignore this field.

Nukesor avatar Apr 28 '22 08:04 Nukesor