Skip to content

Make it easy for users to define hegel-style builders for generators #102

@DRMacIver

Description

@DRMacIver

For example, if I define a generator as

#[hegel::composite]
fn my_gen(tc: hegel::TestCase, some_param: usize) -> MyType {
...
}

Then it would be nice if the following worked:

let x = my_gen(42);
let y = x.some_param(11);

It's probably not super critical and we might want to think about surrounding ergonomics (e.g. this is less useful without being able to default the parameters), but in general it would be nice if it were easy for people to write generators in the style we write them in Hegel.

More generally: Because Generator is a private trait, there's no other way to do this at the moment! I think that's something we probably want to figure out how to fix.

Metadata

Metadata

Assignees

No one assigned

    Labels

    new featurenew capabilities or generators

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions