-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Replace the
core::WrapAlgorithm
enum with a WrapAlgorithm
trait
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.
- Loading branch information
Showing
13 changed files
with
478 additions
and
318 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
#![no_main] | ||
use libfuzzer_sys::fuzz_target; | ||
use textwrap::core::WrapAlgorithm::FirstFit; | ||
use textwrap::wrap_algorithms; | ||
use textwrap::Options; | ||
|
||
fuzz_target!(|input: (String, usize)| { | ||
let options = Options::new(input.1).wrap_algorithm(FirstFit); | ||
let options = Options::new(input.1).wrap_algorithm(wrap_algorithms::FirstFit); | ||
let _ = textwrap::fill(&input.0, &options); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
#![no_main] | ||
use libfuzzer_sys::fuzz_target; | ||
use textwrap::core::WrapAlgorithm::OptimalFit; | ||
use textwrap::wrap_algorithms; | ||
use textwrap::Options; | ||
|
||
fuzz_target!(|input: (String, usize)| { | ||
let options = Options::new(input.1).wrap_algorithm(OptimalFit); | ||
let options = Options::new(input.1).wrap_algorithm(wrap_algorithms::OptimalFit); | ||
let _ = textwrap::fill(&input.0, &options); | ||
}); |
Oops, something went wrong.