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.
@hashedone asked some questions about ownership of variables and passing
String
vs&str
. I realised much of the API was designed when my Rust knowledge was much weaker. I would like to allow novice developers to use the simple case, but we should allow contract developers to use &str in InstantiateMsg, ExecuteMsg, and QueryMsg to avoid copies, without affecting anyone else using this framework. (opt-in per contract).I tried to make a simple demo on Hackatom to see what affect it would have on gas cost (as we currently meter this, so we have a nice comparison).
I had to make a few changes open to more lifetimes in cosmwasm-std, but eventually hit an issue in serde-json-wasm:
https://github.com/CosmWasm/serde-json-wasm/blob/main/src/de/mod.rs#L574-L584
Before I go deeper into this rabbit hole, I would like some feedback. Seems like a rather simple change to make it more general, but let devs still use existing code as DeserializedOwned without any changes.