Commit fb2c9831 authored by Dominik Charousset's avatar Dominik Charousset

Add make_uri convenience function

parent a1798bcb
...@@ -141,6 +141,9 @@ std::string to_string(const uri::authority_type& x); ...@@ -141,6 +141,9 @@ std::string to_string(const uri::authority_type& x);
/// @relates uri /// @relates uri
error parse(string_view str, uri& dest); error parse(string_view str, uri& dest);
/// @relates uri
expected<uri> make_uri(string_view str);
} // namespace caf } // namespace caf
namespace std { namespace std {
......
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
#include "caf/detail/parser/read_uri.hpp" #include "caf/detail/parser/read_uri.hpp"
#include "caf/detail/uri_impl.hpp" #include "caf/detail/uri_impl.hpp"
#include "caf/error.hpp" #include "caf/error.hpp"
#include "caf/expected.hpp"
#include "caf/make_counted.hpp" #include "caf/make_counted.hpp"
#include "caf/serializer.hpp" #include "caf/serializer.hpp"
...@@ -139,4 +140,11 @@ error parse(string_view str, uri& dest) { ...@@ -139,4 +140,11 @@ error parse(string_view str, uri& dest) {
static_cast<size_t>(ps.column)); static_cast<size_t>(ps.column));
} }
expected<uri> make_uri(string_view str) {
uri result;
if (auto err = parse(str, result))
return err;
return result;
}
} // namespace caf } // namespace caf
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment