tntcxx: update response decoding documentation
Nobody has claimed this yet.
- Dominant language
- CSS
- Stars
- 15
- Forks
- 49
- Avg merge
- 1d 13h
- Merged PRs (30d)
- 3
Description
Decoding and reading the data section is almost completely irrelevant since the decoder was reworked, we need to update it.
Class Data has decode method now. One can call it and pass a reference to container in which the tuples are to be placed. For example, your tuples has format [int, int]. That's how decoding of such tuples looks like:
using MyTuple = std::tuple<int, int>;
std::vector<MyTuple> tuples;
data.decode(tuples);
Generally, here are supported objects:
std::nullptr_twill be always decoded asMP_NIL.- fundamental types (
int,float,bool, ...) char[N],std::stringforMP_STR.- Any putable, contiguous (if underlying type is not char) or tuple-like object is considered as
MP_ARR. - Any putable, contiguous (if underlying type is not char) or tuple-like object, containing pairs (including
std::map), is considered asMP_MAP. - Any optional-like object can be decoded as
MP_NILor as its underlying value. - Any variant-like object can be decoded as any of its alternatives.
Also, one can populate its own class with encoding rule using static constexpr mpp_dec or mpp member, containing pointers to the class member. Used members must be public. And, one can use mpp::as_* tag to specify what type to encode into. Semantics is the same as the one in #3967 (these features are described in the end of the issue).
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Open the linked “Decoding and reading the data” section in the getting-started C++ documentation and compare it with the current Data::decode API. Update the section to cover the tuple example, supported decoded object categories, and custom class rules using mpp_dec or mpp and mpp::as_* tags. The section should accurately describe the reworked decoder and provide an example that matches the current API.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- documentation
- Issue type
- Documentation
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 50/100