#ifndef RFL_AVRO_PARSER_HPP_ #define RFL_AVRO_PARSER_HPP_ #include "../Generic.hpp" #include "../NamedTuple.hpp" #include "../Tuple.hpp" #include "../always_false.hpp" #include "../parsing/AreReaderAndWriter.hpp" #include "../parsing/Parser.hpp" #include "Reader.hpp" #include "Writer.hpp" namespace rfl { namespace parsing { /// AVRO requires us to explicitly set all fields. Because /// of that, we require all of the fields and then set them to nullptr, if /// necessary. template requires AreReaderAndWriter> struct Parser, ProcessorsType> : public NamedTupleParser< avro::Reader, avro::Writer, /*_ignore_empty_containers=*/false, /*_all_required=*/true, /*_no_field_names=*/ProcessorsType::no_field_names_, ProcessorsType, FieldTypes...> {}; template requires AreReaderAndWriter> struct Parser, ProcessorsType> : public TupleParser> {}; template requires AreReaderAndWriter> struct Parser, ProcessorsType> : public TupleParser> {}; template requires AreReaderAndWriter struct Parser { template static Result read(const avro::Reader&, const T&) { static_assert(always_false_v, "Generics are unsupported in Avro."); return error("Unsupported"); } template static void write(const avro::Writer&, const Generic&, const P&) { static_assert(always_false_v

, "Generics are unsupported in Avro."); } template static schema::Type to_schema(T*) { static_assert(always_false_v, "Generics are unsupported in Avro."); return schema::Type{}; } }; template requires AreReaderAndWriter< avro::Reader, avro::Writer, internal::Skip> struct Parser, ProcessorsType> { using R = avro::Reader; using W = avro::Writer; template static Result> read(const R&, const U&) { static_assert(always_false_v, "rfl::Skip is unsupported in Avro."); return Error("Unsupported"); } template static void write(const W& /*_w*/, const internal::Skip& /*_skip*/, const P& /*_parent*/) { static_assert(always_false_v

, "rfl::Skip is unsupported in Avro."); } template static schema::Type to_schema(U* /*_definitions*/) { static_assert(always_false_v, "rfl::Skip is unsupported in Avro."); return schema::Type{}; } }; } // namespace parsing } // namespace rfl namespace rfl { namespace avro { template using Parser = parsing::Parser; } } // namespace rfl #endif