Feature flagged out the text module
This commit is contained in:
parent
18fff98d22
commit
16d1eea8fc
4 changed files with 11 additions and 4 deletions
|
|
@ -13,7 +13,8 @@ readme = "README.md"
|
||||||
all-features = true
|
all-features = true
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = []
|
default = ["text"]
|
||||||
|
text = []
|
||||||
unicode = ["unicode-segmentation"]
|
unicode = ["unicode-segmentation"]
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
|
|
|
||||||
2
Makefile
2
Makefile
|
|
@ -7,7 +7,9 @@ doc:
|
||||||
@cargo doc --all-features
|
@cargo doc --all-features
|
||||||
|
|
||||||
test:
|
test:
|
||||||
|
@cargo test
|
||||||
@cargo test --all-features
|
@cargo test --all-features
|
||||||
|
@cargo test --no-default-features
|
||||||
|
|
||||||
format:
|
format:
|
||||||
@rustup component add rustfmt 2> /dev/null
|
@rustup component add rustfmt 2> /dev/null
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,13 @@
|
||||||
//! This crate implements diffing utilities. It attempts to provide an abstraction
|
//! This crate implements diffing utilities. It attempts to provide an abstraction
|
||||||
//! interface over different types of diffing algorithms. It's based on the
|
//! interface over different types of diffing algorithms. It's based on the
|
||||||
//! the diff algorithm implementations of [pijul](https://pijul.org/).
|
//! the diff algorithm implementations of [pijul](https://pijul.org/).
|
||||||
|
|
||||||
//! ```rust
|
//! ```rust
|
||||||
|
//! # #[cfg(feature = "text")] {
|
||||||
//! use similar::text::TextDiff;
|
//! use similar::text::TextDiff;
|
||||||
//! # let old_text = "";
|
//! # let old_text = "";
|
||||||
//! # let new_text = "";
|
//! # let new_text = "";
|
||||||
//! let diff = TextDiff::from_chars("Hello World", "Hallo Welt");
|
//! let diff = TextDiff::from_chars("Hello World", "Hallo Welt");
|
||||||
|
//! # }
|
||||||
//! ```
|
//! ```
|
||||||
//!
|
//!
|
||||||
//! ## Functionality
|
//! ## Functionality
|
||||||
|
|
@ -17,13 +18,15 @@
|
||||||
//! * [`text`]: This extends the general diffing functionality to text (and more
|
//! * [`text`]: This extends the general diffing functionality to text (and more
|
||||||
//! specifically line) based diff operations.
|
//! specifically line) based diff operations.
|
||||||
//!
|
//!
|
||||||
//! ## Optional Features
|
//! ## Features
|
||||||
//!
|
//!
|
||||||
//! The crate by default does not have any dependencies however for some use
|
//! The crate by default does not have any dependencies however for some use
|
||||||
//! cases it's useful to pull in extra functionality:
|
//! cases it's useful to pull in extra functionality. Likewise you can turn
|
||||||
|
//! off some functionality.
|
||||||
//!
|
//!
|
||||||
//! * `unicode`: when this feature is enabled the text diffing functionality
|
//! * `unicode`: when this feature is enabled the text diffing functionality
|
||||||
//! gains the ability to diff on a grapheme instead of character level. This
|
//! gains the ability to diff on a grapheme instead of character level. This
|
||||||
//! is particularly useful when working with text containing emojis.
|
//! is particularly useful when working with text containing emojis.
|
||||||
|
//! * `text`: this feature is enabled by default and enables the [`text`] module.
|
||||||
pub mod algorithms;
|
pub mod algorithms;
|
||||||
pub mod text;
|
pub mod text;
|
||||||
|
|
|
||||||
|
|
@ -47,6 +47,7 @@
|
||||||
//!
|
//!
|
||||||
//! Because the [`TextDiff::grouped_ops`] method can isolate clusters of changes
|
//! Because the [`TextDiff::grouped_ops`] method can isolate clusters of changes
|
||||||
//! this even works for very long files if paired with this method.
|
//! this even works for very long files if paired with this method.
|
||||||
|
#![cfg(feature = "text")]
|
||||||
use std::borrow::Cow;
|
use std::borrow::Cow;
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
use std::io;
|
use std::io;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue