Skip to content

Support for internallength attribute for fixed-size Custom Types #2076

@LucaCappelletti94

Description

@LucaCappelletti94

Hi,

With PR #2068, I have added support for the binary representation for varlena types.

I would like to also add support for fixed-size types, but I am not sure whether the CBOR serialization makes any compression attempt that would turn an apparently fixed-size type into a de-facto varlena type.

I understand that several traits currently derived for varlena types would have to be implemented separately for these fixed-size types - other than that are there any other particular difficulties you foresee?

My plan is to add a decorator like #[internallength(usize)], derive all of the necessary types (including assert_eq(serialized.len(), expected_internal_length) every time I serialize or deserialize to catch errors early) and that should be about it.

Do let me know what do you think of it.

Best,
Luca

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions