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

Replace core::WrapAlgorithm enum with WrapAlgorithm trait #357

Merged
merged 1 commit into from
May 16, 2021

Conversation

mgeisler
Copy link
Owner

@mgeisler mgeisler commented May 15, 2021

This introduces a textwrap::wrap_algorithms module where the wrap_first_fit and wrap_optimal_fit functions now live.

A new WrapAlgorithm trait replaces the old enum. This allows for arbitrary wrapping algorithms to be plugged into the library. We should also be able to change the return type from Vec<&[Word]> to Iterator<Item = Word> and thus implement streaming wrapping for the first-fit in the future.

Fixes #325.

@mgeisler mgeisler force-pushed the wrap-algorithm-trait branch 5 times, most recently from 99e3d8d to 530254f Compare May 16, 2021 19:26
This introduces a `textwrap::wrap_algorithms` module where the
`wrap_first_fit` and `wrap_optimal_fit` functions now live.

A new `WrapAlgorithm` trait replaces the old enum. This allows for
arbitrary wrapping algorithms to be plugged into the library. We
should also be able to change the return type from `Vec<&[Word]>` to
`Iterator<Item = Word>` and thus implement streaming wrapping for the
first-fit in the future.

Fixes #325.
@mgeisler mgeisler force-pushed the wrap-algorithm-trait branch from 530254f to d6b2791 Compare May 16, 2021 19:29
@mgeisler mgeisler merged commit 9def5c6 into master May 16, 2021
@mgeisler mgeisler deleted the wrap-algorithm-trait branch May 16, 2021 19:35
@github-actions github-actions bot mentioned this pull request May 30, 2021
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

Successfully merging this pull request may close these issues.

Introduce a trait for WrapAlgorithm
1 participant