near / borsh-rs

Rust implementation of Binary Object Representation Serializer for Hashing
https://borsh.io/
Apache License 2.0
299 stars 65 forks source link

feat!: add `Definition::Sequence::length_range` field #220

Closed mina86 closed 11 months ago

mina86 commented 11 months ago

Having a length_range field in the Sequence definition allows to better specify encoding formats for bounded vectors. This in turn helps with performing calculations such as figuring out the maximum or minimum length of encoding of a type.

dj8yfo commented 11 months ago

@mina86 you want this or

    Sequence {    // replaces `Array` and supports varint
        length_width: u8,
        min_length: u64,
        max_length: u64,
        elements: Declaration,
    },
mina86 commented 11 months ago

I’m gonig to add length_width and replace Array in next PR.