| 269 | typename Mapped = detail::result_of_t<MapFn(const T&)>, |
| 270 | typename V = typename EnsureFuture<Mapped>::type::ValueType> |
| 271 | AsyncGenerator<V> MakeMappedGenerator(AsyncGenerator<T> source_generator, MapFn map) { |
| 272 | auto map_callback = [map = std::move(map)](const T& val) mutable -> Future<V> { |
| 273 | return ToFuture(map(val)); |
| 274 | }; |
| 275 | return MappingGenerator<T, V>(std::move(source_generator), std::move(map_callback)); |
| 276 | } |
| 277 | |
| 278 | /// \brief Create a generator that will apply the map function to |
| 279 | /// each element of source. The map function is not called on the end |