Skip to content

Commit

Permalink
Fixed load & save for BSON
Browse files Browse the repository at this point in the history
  • Loading branch information
liuzicheng1987 committed Jan 17, 2024
1 parent dee0b5c commit 6f16f50
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions include/rfl/bson/load.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ namespace bson {

template <class T>
Result<T> load(const std::string& _fname) {
const auto read_bytes = [](const auto& _str) { return read<T>(_str); };
return rfl::io::load_string(_fname).and_then(read_bytes);
const auto read_bytes = [](const auto& _bytes) { return read<T>(_bytes); };
return rfl::io::load_bytes(_fname).and_then(read_bytes);
}

} // namespace bson
Expand Down
2 changes: 1 addition & 1 deletion include/rfl/bson/save.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Result<Nothing> save(const std::string& _fname, const T& _obj) {
const auto write_func = [](const auto& _obj, auto& _stream) -> auto& {
return write(_obj, _stream);
};
return rfl::io::save_string(_fname, _obj, write_func);
return rfl::io::save_bytes(_fname, _obj, write_func);
}

} // namespace bson
Expand Down

0 comments on commit 6f16f50

Please sign in to comment.