Simplify API with only top-level functions #213
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is a breaking change which simplifies and stream-lines the API in several ways:
Instead of having both
Wrapper::wrap
and a top-leveltextwrap::wrap
function, we now only have thetextwrap::wrap
function. This should simplify things a little since there is now just one way to use the API.
The
Wrapper
struct has been turned into anOptions
struct.The API of
textwrap::wrap
andtextwrap::fill
functions have changed in a backwards compatible fashion. They still take a string and a width:In addition to a
usize
width, you can now also passOptions
as the second argument:Migration from using
Wrapper
is simple: change a call toWrapper::fill
tofill
:into