Skip to content

Commit

Permalink
Replaced return type to auto.
Browse files Browse the repository at this point in the history
  • Loading branch information
redboltz committed Jan 3, 2024
1 parent 984e81f commit 257b4fd
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 34 deletions.
19 changes: 8 additions & 11 deletions include/async_mqtt/broker/endpoint_variant.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ class epsp_wrap {
// async functions

template <typename CompletionToken>
typename as::async_result<std::decay_t<CompletionToken>, void(optional<packet_id_t>)>::return_type
auto
acquire_unique_packet_id(
CompletionToken&& token
) {
Expand All @@ -160,7 +160,7 @@ class epsp_wrap {
}

template <typename CompletionToken>
typename as::async_result<std::decay_t<CompletionToken>, void(bool)>::return_type
auto
register_packet_id(
packet_id_t packet_id,
CompletionToken&& token
Expand All @@ -176,7 +176,7 @@ class epsp_wrap {
}

template <typename CompletionToken>
typename as::async_result<std::decay_t<CompletionToken>, void()>::return_type
auto
release_packet_id(
packet_id_t packet_id,
CompletionToken&& token
Expand All @@ -192,7 +192,7 @@ class epsp_wrap {
}

template <typename Packet, typename CompletionToken>
typename as::async_result<std::decay_t<CompletionToken>, void(system_error)>::return_type
auto
send(
Packet&& packet,
CompletionToken&& token
Expand All @@ -208,7 +208,7 @@ class epsp_wrap {
}

template <typename CompletionToken>
typename as::async_result<std::decay_t<CompletionToken>, void(packet_variant_type)>::return_type
auto
recv(
CompletionToken&& token
) {
Expand All @@ -222,7 +222,7 @@ class epsp_wrap {
}

template <typename CompletionToken>
typename as::async_result<std::decay_t<CompletionToken>, void()>::return_type
auto
close(
CompletionToken&& token
) {
Expand All @@ -236,7 +236,7 @@ class epsp_wrap {
}

template <typename CompletionToken>
typename as::async_result<std::decay_t<CompletionToken>, void()>::return_type
auto
restore_packets(
std::vector<basic_store_packet_variant<packet_id_bytes>> pvs,
CompletionToken&& token
Expand All @@ -252,10 +252,7 @@ class epsp_wrap {
}

template <typename CompletionToken>
typename as::async_result<
std::decay_t<CompletionToken>,
void(std::vector<basic_store_packet_variant<packet_id_bytes>>)
>::return_type
auto
get_stored_packets(
CompletionToken&& token
) {
Expand Down
30 changes: 12 additions & 18 deletions include/async_mqtt/endpoint.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ class basic_endpoint : public std::enable_shared_from_this<basic_endpoint<Role,
* @return deduced by token
*/
template <typename CompletionToken>
typename as::async_result<std::decay_t<CompletionToken>, void(optional<packet_id_t>)>::return_type
auto
acquire_unique_packet_id(
CompletionToken&& token
) {
Expand All @@ -299,7 +299,7 @@ class basic_endpoint : public std::enable_shared_from_this<basic_endpoint<Role,
* @return deduced by token
*/
template <typename CompletionToken>
typename as::async_result<std::decay_t<CompletionToken>, void(bool)>::return_type
auto
register_packet_id(
packet_id_t packet_id,
CompletionToken&& token
Expand Down Expand Up @@ -327,7 +327,7 @@ class basic_endpoint : public std::enable_shared_from_this<basic_endpoint<Role,
* @return deduced by token
*/
template <typename CompletionToken>
typename as::async_result<std::decay_t<CompletionToken>, void()>::return_type
auto
release_packet_id(
packet_id_t packet_id,
CompletionToken&& token
Expand Down Expand Up @@ -356,7 +356,7 @@ class basic_endpoint : public std::enable_shared_from_this<basic_endpoint<Role,
* @return deduced by token
*/
template <typename Packet, typename CompletionToken>
typename as::async_result<std::decay_t<CompletionToken>, void(system_error)>::return_type
auto
send(
Packet packet,
CompletionToken&& token
Expand Down Expand Up @@ -387,7 +387,7 @@ class basic_endpoint : public std::enable_shared_from_this<basic_endpoint<Role,
* @return deduced by token
*/
template <typename CompletionToken>
typename as::async_result<std::decay_t<CompletionToken>, void(packet_variant_type)>::return_type
auto
recv(
CompletionToken&& token
) {
Expand Down Expand Up @@ -418,7 +418,7 @@ class basic_endpoint : public std::enable_shared_from_this<basic_endpoint<Role,
* @return deduced by token
*/
template <typename CompletionToken>
typename as::async_result<std::decay_t<CompletionToken>, void(packet_variant_type)>::return_type
auto
recv(
std::set<control_packet_type> types,
CompletionToken&& token
Expand Down Expand Up @@ -453,7 +453,7 @@ class basic_endpoint : public std::enable_shared_from_this<basic_endpoint<Role,
* @return deduced by token
*/
template <typename CompletionToken>
typename as::async_result<std::decay_t<CompletionToken>, void(packet_variant_type)>::return_type
auto
recv(
filter fil,
std::set<control_packet_type> types,
Expand Down Expand Up @@ -484,7 +484,7 @@ class basic_endpoint : public std::enable_shared_from_this<basic_endpoint<Role,
* @return deduced by token
*/
template<typename CompletionToken>
typename as::async_result<std::decay_t<CompletionToken>, void()>::return_type
auto
close(CompletionToken&& token) {
ASYNC_MQTT_LOG("mqtt_api", info)
<< ASYNC_MQTT_ADD_VALUE(address, this)
Expand All @@ -509,7 +509,7 @@ class basic_endpoint : public std::enable_shared_from_this<basic_endpoint<Role,
* @return deduced by token
*/
template <typename CompletionToken>
typename as::async_result<std::decay_t<CompletionToken>, void()>::return_type
auto
restore_packets(
std::vector<basic_store_packet_variant<PacketIdBytes>> pvs,
CompletionToken&& token
Expand Down Expand Up @@ -540,10 +540,7 @@ class basic_endpoint : public std::enable_shared_from_this<basic_endpoint<Role,
* @return deduced by token
*/
template <typename CompletionToken>
typename as::async_result<
std::decay_t<CompletionToken>,
void(std::vector<basic_store_packet_variant<PacketIdBytes>>)
>::return_type
auto
get_stored_packets(
CompletionToken&& token
) const {
Expand All @@ -563,10 +560,7 @@ class basic_endpoint : public std::enable_shared_from_this<basic_endpoint<Role,
}

template <typename CompletionToken>
typename as::async_result<
std::decay_t<CompletionToken>,
void(v5::basic_publish_packet<PacketIdBytes>)
>::return_type
auto
regulate_for_store(
v5::basic_publish_packet<PacketIdBytes> packet,
CompletionToken&& token
Expand Down Expand Up @@ -2371,7 +2365,7 @@ class basic_endpoint : public std::enable_shared_from_this<basic_endpoint<Role,
private:

template <typename Packet, typename CompletionToken>
typename as::async_result<std::decay_t<CompletionToken>, void(system_error)>::return_type
auto
send(
Packet packet,
bool from_queue,
Expand Down
6 changes: 3 additions & 3 deletions include/async_mqtt/stream.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ class stream : public std::enable_shared_from_this<stream<NextLayer>> {
}

template <typename CompletionToken>
typename as::async_result<std::decay_t<CompletionToken>, void(error_code, buffer)>::return_type
auto
read_packet(
CompletionToken&& token
) {
Expand All @@ -130,7 +130,7 @@ class stream : public std::enable_shared_from_this<stream<NextLayer>> {
}

template <typename Packet, typename CompletionToken>
typename as::async_result<std::decay_t<CompletionToken>, void(error_code, std::size_t)>::return_type
auto
write_packet(
Packet packet,
CompletionToken&& token
Expand Down Expand Up @@ -169,7 +169,7 @@ class stream : public std::enable_shared_from_this<stream<NextLayer>> {
}

template<typename CompletionToken>
typename as::async_result<std::decay_t<CompletionToken>, void(error_code)>::return_type
auto
close(CompletionToken&& token) {
return
as::async_compose<
Expand Down
4 changes: 2 additions & 2 deletions include/async_mqtt/ws_fixed_size_async_read.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ template <
as::is_mutable_buffer_sequence<MutableBufferSequence>::value
>* = nullptr
>
typename as::async_result<std::decay_t<CompletionToken>, void(boost::system::error_code const&, std::size_t)>::return_type
auto
async_read(
bs::websocket::stream<NextLayer>& stream,
MutableBufferSequence const& mb,
Expand All @@ -98,7 +98,7 @@ template <
as::is_const_buffer_sequence<ConstBufferSequence>::value
>* = nullptr
>
typename as::async_result<std::decay_t<CompletionToken>, void(boost::system::error_code const&, std::size_t)>::return_type
auto
async_write(
bs::websocket::stream<NextLayer>& stream,
ConstBufferSequence const& cbs,
Expand Down

0 comments on commit 257b4fd

Please sign in to comment.