Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 0 additions & 20 deletions fuzzy/src/debug_output.rs

This file was deleted.

12 changes: 6 additions & 6 deletions fuzzy/src/diff_output.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
//! Provides an implementation of [`Output`] that mimics git's character-level diff.

use crate::{Output, Match, Step};
use crate::{Match, Step};
use std::fmt;

// NOTE: because we do character by character diffs, this won't be the real diff format
// for now. Instead, we will mimic the git diff format, expect we print out all matching
// for now. Instead, we will mimic the git diff format, except we print out all matching
// lines and don't print any line numbers.
//
// The wording in these structs treat the patttern as the original, and text as new. So
Expand All @@ -14,6 +12,8 @@ use std::fmt;
// TODO make this configurable
const ANY: char = '?';

/// A quick display of the final trace, similar to the git character-level diff format.
/// Convenient for small texts.
pub struct DiffOutput {
pub chunks: Vec<Chunk>,
}
Expand Down Expand Up @@ -48,8 +48,8 @@ pub struct Same { pub text: Vec<char> }
#[derive(Eq, PartialEq, Debug)]
pub struct Diff { pub taken: Vec<char>, pub added: Vec<char> }

impl Output for DiffOutput {
fn new(_score: &usize, trace: &Vec<Step<Match, char>>) -> Self {
impl DiffOutput {
pub fn new(_score: &usize, trace: &Vec<Step<Match, char>>) -> Self {
let mut chunks = vec![];
for step in trace.iter() {
let current_chunk = chunks.last_mut();
Expand Down
Loading