5#ifndef MP_PROXY_TYPE_DATA_H
6#define MP_PROXY_TYPE_DATA_H
14template <
typename T,
typename U>
16 std::convertible_to<T, std::span<const U>> &&
17 std::constructible_from<T, const U*, const U*>;
30template <
typename LocalType,
typename Value,
typename Output>
34 auto data = std::span{value};
35 auto result = output.init(data.size());
36 memcpy(result.begin(), data.data(), data.size());
39template <
typename LocalType,
typename Input,
typename ReadDest>
43 using ByteType =
decltype(std::span{std::declval<LocalType>().begin(), std::declval<LocalType>().end()})::element_type;
44 const kj::byte *begin{input.get().begin()}, *end{input.get().end()};
45 return read_dest.construct(
reinterpret_cast<const ByteType*
>(begin),
reinterpret_cast<const ByteType*
>(end));
Functions to serialize / deserialize common bitcoin types.
decltype(auto) CustomReadField(TypeList< LocalType >, Priority< 1 >, InvokeContext &invoke_context, Input &&input, ReadDest &&read_dest)
void CustomBuildField(TypeList< LocalType >, Priority< 1 >, InvokeContext &invoke_context, Value &&value, Output &&output)
Generic utility functions used by capnp code.