Skip to content

Empty generator #210

Open
Open
@rafalg

Description

@rafalg

Hi,

Thanks for creating cobalt. Feels like python asyncio but in c++.
Been trying to use generators to model results of paginated api like aws s3::list_objects.
All in all seems pretty strightforward , I can co_yeild individual response elements and co_return the last one.
But came across a corner case where api will respond with 0 elements. My outer loop is:

auto keys = s3.list_objects("test-bucket");

while (keys) {
  auto key = co_await keys;
}

In python when list_objects goes out of scope simply terminates generator.
In cobalt I got the

  what():  cobalt::generator returned void

Any help appreciated!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions