Skip to content

Commit

Permalink
Merge pull request #403 from robinkrahl/example-features
Browse files Browse the repository at this point in the history
Configure required features for examples
  • Loading branch information
mgeisler committed Jul 2, 2021
2 parents 7cec76d + ac9c654 commit 48320ec
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 16 deletions.
8 changes: 8 additions & 0 deletions Cargo.toml
Expand Up @@ -12,6 +12,14 @@ license = "MIT"
edition = "2018"
exclude = [".github/", ".gitignore", "benches/", "examples/", "fuzz/", "images/"]

[[example]]
name = "hyphenation"
required-features = ["hyphenation"]

[[example]]
name = "termwidth"
required-features = ["terminal_size"]

[package.metadata.docs.rs]
all-features = true

Expand Down
9 changes: 0 additions & 9 deletions examples/hyphenation.rs
@@ -1,14 +1,5 @@
#[cfg(feature = "hyphenation")]
use hyphenation::{Language, Load, Standard};

#[cfg(not(feature = "hyphenation"))]
fn main() {
println!("Please run this example as");
println!();
println!(" cargo run --example hyphenation --features hyphenation");
}

#[cfg(feature = "hyphenation")]
fn main() {
let text = "textwrap: a small library for wrapping text.";
let dictionary = Standard::from_embedded(Language::EnglishUS).unwrap();
Expand Down
7 changes: 0 additions & 7 deletions examples/termwidth.rs
@@ -1,12 +1,5 @@
#[cfg(feature = "terminal_size")]
use textwrap::{fill, Options};

#[cfg(not(feature = "terminal_size"))]
fn main() {
println!("Please enable the terminal_size Cargo feature to run this example.");
}

#[cfg(feature = "terminal_size")]
fn main() {
let example = "Memory safety without garbage collection. \
Concurrency without data races. \
Expand Down

0 comments on commit 48320ec

Please sign in to comment.