Open leighmcculloch opened 2 years ago
Two challenges with this:
Recursive types like ClaimPredicate
currently use the Box
type. We might be able to use the heapless
pooled Box
type instead. Or maybe we drop any type containing recursion, or replace the use of the type with some other type like ClaimPredicateNoRecursion
. Or maybe we generate unique types up to some depth where the final depth has nothing.
Variable length arrays are Vec
types under the hood. We could allocate fixed length arrays at the max length of the variable length type and use them instead. That's pretty simple, and heapless
has a type we can use for that too. There is one additional challenge that our XDR contains unbounded variable length arrays and these realistically can't be allocated at u32::MAX. We'd need to provide some max capacity and hope for the best. Alternatively we just drop any type with a variable length field.
As a follow on from https://github.com/stellar/rs-stellar-xdr/pull/44, this issue is being repurposed to change the alloc
feature so it is possible to use the default global allocator, or provide your own allocator.
Similar to #38 there's value in us providing use of this lib in situations where
alloc
isn't available or the heap isn't ideal to use.This isn't urgent to do now, but something that would be nice to do.