| #[cfg(feature = "hyphenation")] |
| extern crate hyphenation; |
| #[cfg(feature = "hyphenation")] |
| use hyphenation::{Language, Load}; |
| #[cfg(not(feature = "hyphenation"))] |
| fn new_wrapper<'a>() -> Wrapper<'a, textwrap::HyphenSplitter> { |
| #[cfg(feature = "hyphenation")] |
| fn new_wrapper<'a>() -> Wrapper<'a, hyphenation::Standard> { |
| let dictionary = hyphenation::Standard::from_embedded(Language::EnglishUS).unwrap(); |
| Wrapper::with_splitter(0, dictionary) |
| let example = "Memory safety without garbage collection. \ |
| Concurrency without data races. \ |
| Zero-cost abstractions."; |
| let mut prev_lines = vec![]; |
| let mut wrapper = new_wrapper(); |
| let lines = wrapper.wrap(example); |
| let title = format!(" Width: {} ", width); |
| println!(".{:-^1$}.", title, width + 2); |
| println!("| {:1$} |", line, width); |