borsh-rs
borsh-rs copied to clipboard
Skip adding the where clause to avoid triggering overflow
Problem
#[derive(BorshSerialize, BorshDeserialize)]
enum A {
B,
C {
d: Vec<A>,
},
}
gives overflow evaluating the requirement A: BorshDeserialize
or BorshSerialize
Idea
Allow skipping adding to the where clause with an attribute to allow edge cases to function.
I am told this could help https://github.com/rust-lang/rust/issues/48214 but there is currently no way to achieve the same effect "working for recursive data structure" by determining automatically which where clause to add in the proc_macro
Not complete yet as this attribute only has an effect for an enum
Related issues
https://github.com/near/borsh-rs/issues/7
Please, add tests
Sorry, i did have the file locally but forgot to add it. Pushed now
Please note that I am waiting for your agreement on the broad feature before I'll add it to other types.
@Arrowana The reason I asked for the test is to see how this is expected to be used.
Reading https://github.com/near/borsh-rs/issues/7#issuecomment-765582816:
serde, can handle this case, btw
I wonder how they achieved that and whether it is possible to do here, so we don't need to have this attribute.
@Arrowana The reason I asked for the test is to see how this is expected to be used.
Reading #7 (comment):
serde, can handle this case, btw
I wonder how they achieved that and whether it is possible to do here, so we don't need to have this attribute.
I looked at this user repositories, i found this https://github.com/near/borsh-rs/pull/96#issuecomment-1196652786
MachineValue
is recursive
This is also my current workaround, manual trait implementation, just seems to be a lot of redo.
I would much prefer a solution that doesn't require the attribute but i just don't know how or if it is feasible at all.
I would much prefer a solution that doesn't require the attribute but i just don't know how or if it is feasible at all.
It is possible, serde handles it. It's definitely more of an extensive process which I had started previously but somewhat abandoned since I didn't have the bandwidth. This is somewhat related to #41 and the issue that points this out is #7
I think this PR is stalled and is not required anymore, so I am closing it.