Skip to content

Conversation

ryanofsky
Copy link
Collaborator

When converting C++ std::pair and length 2 std::tuple values to and from capn'proto structs, no longer require the struct to have fields named "key" and "value". Instead always map the first pair/tuple element to the first struct field, and the second element to the second field.

This allows anonymous std::pair and std::tuple types used in the C++ interface to have names and custom Read/Build logic when they are serialized as capn'proto messages.

For now only length-2 tuples are supported but this could be extended to support converting c++ tuples of arbitrary length to capn'proto structs with the same number of fields.

When converting C++ std::pair and length 2 std::tuple values to and from
capn'proto structs, no longer require the struct to have fields named "key" and
"value".  Instead always map the first pair/tuple element to the first struct
field, and the second element to the second field.

This allows anonymous std::pair and std::tuple types used in the C++ interface
to have names and custom Read/Build logic when they are serialized as
capn'proto messages.

For now only length-2 tuples are supported but this could be extended to
support converting c++ tuples of arbitrary length to capn'proto structs with
the same number of fields.
@ryanofsky ryanofsky merged commit aea56f0 into bitcoin-core:master Sep 20, 2023
ryanofsky added a commit to ryanofsky/bitcoin that referenced this pull request Sep 20, 2023
Update libmultiprocess to include change "Remove naming requirement for
std::pair/std::tuple" bitcoin-core/libmultiprocess#85
needed to support src/ipc/capnp/chain.capn RPCArg struct which is mapped to a
std::pair in an upcoming commit.
ryanofsky added a commit to ryanofsky/bitcoin that referenced this pull request Sep 26, 2023
Update libmultiprocess to include change "Remove naming requirement for
std::pair/std::tuple" bitcoin-core/libmultiprocess#85
needed to support src/ipc/capnp/chain.capn RPCArg struct which is mapped to a
std::pair in an upcoming commit.
ryanofsky added a commit to ryanofsky/bitcoin that referenced this pull request Sep 26, 2023
Update libmultiprocess to include change "Remove naming requirement for
std::pair/std::tuple" bitcoin-core/libmultiprocess#85
needed to support src/ipc/capnp/chain.capn RPCArg struct which is mapped to a
std::pair in an upcoming commit.
ryanofsky added a commit to ryanofsky/bitcoin that referenced this pull request Sep 28, 2023
Update libmultiprocess to include newer changes:

- "Remove naming requirement for std::pair/std::tuple" (bitcoin-core/libmultiprocess#85)
  To support adding a src/ipc/capnp/chain.capnp RPCArg struct which is mapped
  to a std::pair in a upcoming commit.

- Add support for vector<bool> serialization (bitcoin-core/libmultiprocess#86)
  To support adding serializing recently-added vector<bool> txout_is_change.
ryanofsky added a commit to ryanofsky/bitcoin that referenced this pull request Oct 20, 2023
Update libmultiprocess to include newer changes:

- "Remove naming requirement for std::pair/std::tuple" (bitcoin-core/libmultiprocess#85)
  To support adding a src/ipc/capnp/chain.capnp RPCArg struct which is mapped
  to a std::pair in a upcoming commit.

- Add support for vector<bool> serialization (bitcoin-core/libmultiprocess#86)
  To support adding serializing recently-added vector<bool> txout_is_change.
ryanofsky added a commit to ryanofsky/bitcoin that referenced this pull request Oct 20, 2023
Update libmultiprocess to include newer changes:

- "Remove naming requirement for std::pair/std::tuple" (bitcoin-core/libmultiprocess#85)
  To support adding a src/ipc/capnp/chain.capnp RPCArg struct which is mapped
  to a std::pair in a upcoming commit.

- Add support for vector<bool> serialization (bitcoin-core/libmultiprocess#86)
  To support adding serializing recently-added vector<bool> txout_is_change.
ryanofsky added a commit to ryanofsky/bitcoin that referenced this pull request Oct 24, 2023
Update libmultiprocess to include newer changes:

- "Remove naming requirement for std::pair/std::tuple" (bitcoin-core/libmultiprocess#85)
  To support adding a src/ipc/capnp/chain.capnp RPCArg struct which is mapped
  to a std::pair in a upcoming commit.

- Add support for vector<bool> serialization (bitcoin-core/libmultiprocess#86)
  To support adding serializing recently-added vector<bool> txout_is_change.
ryanofsky added a commit to ryanofsky/bitcoin that referenced this pull request Oct 24, 2023
Update libmultiprocess to include newer changes:

- "Remove naming requirement for std::pair/std::tuple" (bitcoin-core/libmultiprocess#85)
  To support adding a src/ipc/capnp/chain.capnp RPCArg struct which is mapped
  to a std::pair in a upcoming commit.

- Add support for vector<bool> serialization (bitcoin-core/libmultiprocess#86)
  To support adding serializing recently-added vector<bool> txout_is_change.
@bitcoin-core bitcoin-core locked and limited conversation to collaborators Jun 25, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant