Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Xz builder pattern #129

Open
ikrivosheev opened this issue Aug 13, 2024 · 2 comments
Open

Xz builder pattern #129

ikrivosheev opened this issue Aug 13, 2024 · 2 comments

Comments

@ikrivosheev
Copy link

Hello! I have an idea. Now my code looks something like this:

let mut filters = Filters::new();
filters.lzma1_properties(properties)?;

let stream = Stream::new_raw_decoder(&filters)?;

let mut decoder = XzDecoder::new_stream(input, stream);

I think using builder pattern will improve user experience.

@ChanTsune
Copy link

Builder pattern, It's worth considering! However, I think we should be cautious in its implementation because there are several ways to implement the builder pattern—such as having methods consume ownership or return references—and different people have different preferences. so I'm a bit cautious about introducing it.

Whether to actually introduce the builder pattern is another matter, but I envisioned something like an XzDecoderBuilder::new().filter().build(). Do you have a more specific image in mind?

@ikrivosheev
Copy link
Author

Well, I'll try to make a draft with examples of using.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants