gencode icon indicating copy to clipboard operation
gencode copied to clipboard

allow custom marschallers

Open JAicewizard opened this issue 6 years ago • 0 comments

Allow for custom types that are able to marschall themselves.

For example, the following should assume that the type Data in package A has the Size, Marschall and Unmarschall functions and use those to generate code.

struct Person {
  Name string
  Age A.Data //sizeMarschal
}

It might not be practical for every struct to have a .Size method(for whatever reason) so the following should get the bytes and prefix the length itself.

struct Person {
  Name string
  Age A.Data //Marschal
}

EDIT: when only the Marschal type is specifiend dont generate a size Method, or only support the sizeMarschal type.

JAicewizard avatar Apr 13 '19 09:04 JAicewizard