Skip to content

feat: added borsh schema - #506

Merged
alejandro-vaz merged 5 commits into
servo:v2from
alejandro-vaz:schema
Aug 31, 2026
Merged

alejandro-vaz merged 5 commits into
servo:v2from
alejandro-vaz:schema

Conversation

@alejandro-vaz

@alejandro-vaz alejandro-vaz commented Aug 30, 2026 •

Copy link
Copy Markdown
Collaborator

this PR implements borsh::BorshSchema for SmallVec

the derive and unstable__schema features of borsh had to be enabled

closes #503

schema

SmallVec schema is the same one Vec has

it consists of:

  • an usize for length, that only indicates the amount of items
  • all the elements serialized

this PR changes the serialization in order not to serialize the TaggedLen directly but it's value. this is important because the schema is only correct if the usize represents the amount of elements and not our custom length representation

@alejandro-vaz
alejandro-vaz requested a review from jdm August 30, 2026 16:15
@alejandro-vaz alejandro-vaz self-assigned this Aug 30, 2026
@alejandro-vaz
alejandro-vaz marked this pull request as draft August 30, 2026 19:00
@alejandro-vaz
alejandro-vaz marked this pull request as ready for review August 30, 2026 19:29
Comment thread src/borsh.rs
Signed-off-by: Alejandro Vaz <alejandro.vaz.myt@gmail.com>
@alejandro-vaz
alejandro-vaz added this pull request to the merge queue Aug 31, 2026
Merged via the queue into servo:v2 with commit 88d7ddc Aug 31, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

add a type implementing BorshSchema of SmallVec

2 participants