Skip to content

Commit

Permalink
netsocket: provide the shorthand net::result<T> for `tl::expected<T…
Browse files Browse the repository at this point in the history
…, std::error_code>`

Plus, add the necessary dependency for the `netplay` library
in order for it to find `tl::expected` header files.

Signed-off-by: Pavel Solodovnikov <[email protected]>
  • Loading branch information
ManManson committed Oct 13, 2024
1 parent e565f36 commit 30eeaf6
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/netplay/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,9 @@ add_dependencies(netplay autorevision_netcodeversion)
set_property(TARGET netplay PROPERTY FOLDER "lib")
include(WZTargetConfiguration)
WZ_TARGET_CONFIGURATION(netplay)
target_link_libraries(netplay PRIVATE framework re2::re2 nlohmann_json plum-static Threads::Threads ZLIB::ZLIB)
target_link_libraries(netplay
PRIVATE framework re2::re2 nlohmann_json plum-static Threads::Threads ZLIB::ZLIB
PUBLIC tl::expected)

if(WZ_USE_IMPORTED_MINIUPNPC)
target_link_libraries(netplay PRIVATE imported-miniupnpc)
Expand Down
9 changes: 9 additions & 0 deletions lib/netplay/netsocket.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,17 @@

#include "lib/framework/types.h"
#include <string>
#include <system_error>
#include <vector>

#include <tl/expected.hpp>

namespace net
{
template <typename T>
using result = ::tl::expected<T, std::error_code>;
} // namespace net

#if defined(WZ_OS_UNIX)
# include <arpa/inet.h>
# include <errno.h>
Expand Down

0 comments on commit 30eeaf6

Please sign in to comment.