Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
word_filter
A Word Filter for filtering text.
A Word Filter is a system for identifying and censoring specific words or phrases in strings. Common usage includes censoring vulgar or profane language and preventing spam or vandelism in user-provided content.
The Word Filter implementation provided here allows for advanced filtering functionality, including:
- Finding and censoring filtered words.
- Ignoring words that are considered "exceptions".
- Allowing specification of "aliases", i.e. strings that can replace other strings (for example, an alias could be created to replace the letter "a" with the character "@").
- Ignoring specified separators (such as spaces or other characters) between letters of filtered words.
A Word Filter is useful for checking and censoring user-generated text in chat applications, online games, and many other contexts.
Usage
This crate is intended to be used along-side the
word_filter_codegen
crate. A WordFilter
is
created within the build.rs
file at compile-time using a WordFilterGenerator
from the
word_filter_codegen
crate. See the documentation for further details.
Example
For example, a simple WordFilter
can be generated by the following.
First, add both the word_filter
and word_filter_codegen
crates to the Cargo.toml
[dependencies]
and [build-dependencies]
lists respectively. Be sure their versions match.
[]
= "0.5.0"
[]
= "0.5.0"
Next, generate the WordFilter
in the build.rs
file.
use ;
use ;
And finally, include the generated code in the lib.rs
file.
include!;
assert!;
Minimum Supported Rust Version
This crate is guaranteed to compile on stable rustc 1.51.0
and up.
License
This project is licensed under either of
- Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.
Contribution
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.