Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
config: support custom configuration of diff
- Loading branch information
1 parent
26bd02f
commit a570f5f
Showing
4 changed files
with
252 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/// Symbols used to indicate removed and added lines. | ||
#[derive(Clone, Copy)] | ||
pub enum LineSymbol { | ||
/// Use '<' and '>' | ||
Arrow, | ||
/// Use '-' and '+' | ||
Sign, | ||
} | ||
|
||
impl Default for LineSymbol { | ||
fn default() -> Self { | ||
Self::Arrow | ||
} | ||
} | ||
|
||
/// Configuration object to pass to supported macros with `assert_eq!(config = config, ...)` | ||
#[derive(Clone, Copy, Default)] | ||
pub struct Config { | ||
_private: (), | ||
pub(crate) line_symbol: LineSymbol, | ||
} | ||
|
||
impl Config { | ||
/// Set the symbols used to indicate removed and added lines. | ||
pub fn line_symbol(mut self, value: LineSymbol) -> Self { | ||
self.line_symbol = value; | ||
self | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.