Skip to content

Commit

Permalink
Rearranged Reader.cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
liuzicheng1987 committed Dec 1, 2024
1 parent 1f22054 commit b1f7755
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/rfl/avro/Reader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,22 +24,22 @@ rfl::Result<Reader::InputArrayType> Reader::to_array(
return InputArrayType{_var.val_};
}

rfl::Result<Reader::InputUnionType> Reader::to_union(
rfl::Result<Reader::InputObjectType> 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::InputObjectType> Reader::to_object(
rfl::Result<Reader::InputUnionType> 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

0 comments on commit b1f7755

Please sign in to comment.