mgeisler / textwrap

An efficient and powerful Rust library for word wrapping text.
MIT License
446 stars 44 forks source link

use of undeclared crate or module `hyphenation` #505

Closed noble-varghese closed 1 year ago

noble-varghese commented 1 year ago

When trying to compile the code shown on the example in - https://github.com/mgeisler/textwrap/blob/edc56bfe9556ac84fd1ff7ee23e52352b86bb9d2/examples/hyphenation.rs I get the following the error as shown on the screenshot attached here. The error says "use of undeclared crate or module hyphenation". How do I resolve this. image

mgeisler commented 1 year ago

Hi @noble-varghese,

The code there depends on the hyphenation crate declared in the Cargo.toml file.

mgeisler commented 1 year ago

You can actually see this in the Cargo.toml file` which says

[[example]]
name = "hyphenation"
path = "examples/hyphenation.rs"
required-features = ["hyphenation"]

for this particular example. This means that Cargo will give you an error if you try to run the example without the necessary feature:

% cargo run --example hyphenation
error: target `hyphenation` in package `textwrap` requires the features: `hyphenation`
Consider enabling them by passing, e.g., `--features="hyphenation"

I hope that helps!