rust-typed-builder icon indicating copy to clipboard operation
rust-typed-builder copied to clipboard

Calling some methods on the builder type directly without calling `.build()`

Open KSXGitHub opened this issue 8 months ago • 0 comments

I use the builder pattern mainly to emulate named arguments. But I don't want to have to call build.

What I must do currently

DoSomething::builder()
    .foo(foo)
    .bar(bar)
    .build() // <- I want to remove this
    .run()
    .await // the `into` attribute cannot handle opaque type such as `impl Future`, which was why calling `build` is the only way

What I hope for

DoSomething::builder()
    .foo(foo)
    .bar(bar)
    .run() // this function captures DoSomethingBuilder by move
    .await

KSXGitHub avatar Oct 16 '23 13:10 KSXGitHub