Make encoding functions public #322
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Overview
Many APIs of candid encoding are private. This makes it harder to use this library in case of unusual scenarios implementation.
In one of my projects (ic-event-hub) I need to be able to transfer a (possibly very big) batch of objects between canisters in as few messages as possible, as efficiently as possible. I can achieve that using
ValueSerializerandTypeSerializestructs, filling messages with objects sequentially. But in order to do that, I'm using a customcandidfork where all methods of these structs are public.Here is the PR with some of these methods made public (enough to achieve what I want). But I strongly recommend the team managing this repo to choose more open policy in terms of method visibility and to make everything public. Yes, this will increase the risk of error making for beginners. But for experienced developers who understand the internals this is actually a lot more useful, because it allows them to program custom serialization logic on top of this library.
Considerations
This PR doesn't affect performance or security, but it could be useful to mark affected methods as
FOR ADVANCED USE ONLYin the docs.