mirror of
https://github.com/Naios/continuable.git
synced 2026-02-14 14:19:48 +08:00
Move transforms in their own toplevel namespace
This commit is contained in:
parent
5c4d28233c
commit
20c54f54cb
@ -35,6 +35,12 @@
|
|||||||
#include <continuable/detail/transforms.hpp>
|
#include <continuable/detail/transforms.hpp>
|
||||||
|
|
||||||
namespace cti {
|
namespace cti {
|
||||||
|
/// The namespace transforms declares callable objects that transform
|
||||||
|
/// any continuable_base to an object or to a continuable_base itself.
|
||||||
|
///
|
||||||
|
/// Transforms can be applied to continuables through using
|
||||||
|
/// the continuable-base::apply method accordingly.
|
||||||
|
namespace transforms {
|
||||||
/// Returns a transform that if applied to a continuable,
|
/// Returns a transform that if applied to a continuable,
|
||||||
/// it will start the continuation chain and returns the asynchronous
|
/// it will start the continuation chain and returns the asynchronous
|
||||||
/// result as `std::future<...>`.
|
/// result as `std::future<...>`.
|
||||||
@ -76,6 +82,7 @@ inline auto flatten() {
|
|||||||
return std::forward<decltype(continuable)>(continuable).fail([](auto&&) {});
|
return std::forward<decltype(continuable)>(continuable).fail([](auto&&) {});
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
} // namespace transforms
|
||||||
} // namespace cti
|
} // namespace cti
|
||||||
|
|
||||||
#endif // CONTINUABLE_TRANSFORMS_HPP_INCLUDED__
|
#endif // CONTINUABLE_TRANSFORMS_HPP_INCLUDED__
|
||||||
|
|||||||
@ -36,7 +36,7 @@ bool is_ready(T& future) {
|
|||||||
|
|
||||||
TYPED_TEST(single_dimension_tests, are_convertible_to_futures) {
|
TYPED_TEST(single_dimension_tests, are_convertible_to_futures) {
|
||||||
{
|
{
|
||||||
auto future = this->supply().apply(cti::futurize());
|
auto future = this->supply().apply(cti::transforms::futurize());
|
||||||
ASSERT_TRUE(is_ready(future));
|
ASSERT_TRUE(is_ready(future));
|
||||||
future.get();
|
future.get();
|
||||||
}
|
}
|
||||||
@ -47,7 +47,7 @@ TYPED_TEST(single_dimension_tests, are_convertible_to_futures) {
|
|||||||
// ...
|
// ...
|
||||||
return 0xFD;
|
return 0xFD;
|
||||||
})
|
})
|
||||||
.apply(cti::futurize());
|
.apply(cti::transforms::futurize());
|
||||||
|
|
||||||
ASSERT_TRUE(is_ready(future));
|
ASSERT_TRUE(is_ready(future));
|
||||||
EXPECT_EQ(future.get(), 0xFD);
|
EXPECT_EQ(future.get(), 0xFD);
|
||||||
@ -69,8 +69,8 @@ TYPED_TEST(single_dimension_tests, are_convertible_to_futures) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TYPED_TEST(single_dimension_tests, are_flattable) {
|
TYPED_TEST(single_dimension_tests, are_flattable) {
|
||||||
auto continuation =
|
auto continuation = this->supply_exception(supply_test_exception())
|
||||||
this->supply_exception(supply_test_exception()).apply(cti::flatten());
|
.apply(cti::transforms::flatten());
|
||||||
|
|
||||||
ASSERT_ASYNC_INCOMPLETION(std::move(continuation));
|
ASSERT_ASYNC_INCOMPLETION(std::move(continuation));
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user