From b1f77554c0ed9a70807ab1ce5e02e2bb295b44a3 Mon Sep 17 00:00:00 2001 From: "Dr. Patrick Urbanke" Date: Sun, 1 Dec 2024 17:29:57 +0100 Subject: [PATCH] Rearranged Reader.cpp --- src/rfl/avro/Reader.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/rfl/avro/Reader.cpp b/src/rfl/avro/Reader.cpp index 756bbbc3..d75ca069 100644 --- a/src/rfl/avro/Reader.cpp +++ b/src/rfl/avro/Reader.cpp @@ -24,22 +24,22 @@ rfl::Result Reader::to_array( return InputArrayType{_var.val_}; } -rfl::Result Reader::to_union( +rfl::Result Reader::to_object( const InputVarType& _var) const noexcept { const auto type = avro_value_get_type(_var.val_); - if (type != AVRO_UNION) { - return Error("Could not cast to a union."); + if (type != AVRO_RECORD && type != AVRO_MAP) { + return Error("Could not cast to an object."); } - return InputUnionType{_var.val_}; + return InputObjectType{_var.val_}; } -rfl::Result Reader::to_object( +rfl::Result Reader::to_union( const InputVarType& _var) const noexcept { const auto type = avro_value_get_type(_var.val_); - if (type != AVRO_RECORD && type != AVRO_MAP) { - return Error("Could not cast to an object."); + if (type != AVRO_UNION) { + return Error("Could not cast to a union."); } - return InputObjectType{_var.val_}; + return InputUnionType{_var.val_}; } } // namespace rfl::avro