Function line_diff::compare_lines

source ·
pub fn compare_lines(config: Config) -> Result<(), Box<dyn Error>>
Expand description

Comapare two lines with given configuration.

  • config - Configuration
Examples found in repository?
examples/longlines.rs (line 17)
8
9
10
11
12
13
14
15
16
17
18
fn main() -> Result<()> {
    println!("Example with using a single file containing two lines");
    let config = Config::from_file(
        false,
        false,
        vec![' '],
        PathBuf::from("examples/long-lines.txt"),
    );
    println!("{:?}", config);
    compare_lines(config)
}
More examples
Hide additional examples
examples/sort.rs (line 11)
7
8
9
10
11
12
13
14
15
16
17
fn main() -> Result<()> {
    println!("Example without sorting");
    let config = Config::from_lines(false, false, vec![' '], "Hello World", "World Hello");
    println!("{:?}", config);
    compare_lines(config)?;

    println!("Example with sorting");
    let config = Config::from_lines(true, false, vec![' '], "Hello World", "World Hello");
    println!("{:?}", config);
    compare_lines(config)
}
examples/lowercase.rs (line 11)
7
8
9
10
11
12
13
14
15
16
17
fn main() -> Result<()> {
    println!("Example without lowercase");
    let config = Config::from_lines(false, false, vec![' '], "Hello World", "Hello world");
    println!("{:?}", config);
    compare_lines(config)?;

    println!("Example with sorting");
    let config = Config::from_lines(false, true, vec![' '], "Hello World", "Hello world");
    println!("{:?}", config);
    compare_lines(config)
}
examples/separators.rs (line 11)
7
8
9
10
11
12
13
14
15
16
17
fn main() -> Result<()> {
    println!("Example without only ';' as separator");
    let config = Config::from_lines(false, false, vec![' '], "Hello;Wor ld", "Hello;Wor ld");
    println!("{:?}", config);
    compare_lines(config)?;

    println!("Example with ';' and ' ' as separators");
    let config = Config::from_lines(false, false, vec![' ', ';'], "Hello;Wor ld", "Hello;Wor ld");
    println!("{:?}", config);
    compare_lines(config)
}
examples/construction.rs (line 12)
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
fn main() -> Result<()> {
    println!("Example with two lines");
    let config = Config::from_lines(false, false, vec![' '], "Hello World", "hello World");
    println!("{:?}", config);
    compare_lines(config)?;

    println!("Example with using a single file containing two lines");
    let config = Config::from_file(
        false,
        false,
        vec![' '],
        PathBuf::from("examples/twolines.txt"),
    );
    println!("{:?}", config);
    compare_lines(config)
}