use std::{collections::HashMap, path::PathBuf};
use bstr::BString;
pub use imara_diff::*;
#[allow(clippy::empty_docs)]
pub mod pipeline;
#[allow(clippy::empty_docs)]
pub mod platform;
#[derive(Debug, Default, Clone, Copy, PartialEq, PartialOrd)]
pub struct DiffLineStats {
pub removals: u32,
pub insertions: u32,
pub before: u32,
pub after: u32,
pub similarity: f32,
}
#[derive(Copy, Clone, Debug, Ord, PartialOrd, Eq, PartialEq, Hash)]
pub enum ResourceKind {
OldOrSource,
NewOrDestination,
}
#[derive(Default, Debug, Clone, PartialEq, Eq)]
pub struct Driver {
pub name: BString,
pub command: Option<BString>,
pub algorithm: Option<Algorithm>,
pub binary_to_text_command: Option<BString>,
pub is_binary: Option<bool>,
}
#[derive(Clone)]
pub struct Pipeline {
pub roots: pipeline::WorktreeRoots,
pub worktree_filter: gix_filter::Pipeline,
pub options: pipeline::Options,
drivers: Vec<Driver>,
attrs: gix_filter::attributes::search::Outcome,
path: PathBuf,
}
#[derive(Clone)]
pub struct Platform {
old: Option<platform::CacheKey>,
new: Option<platform::CacheKey>,
pub options: platform::Options,
pub filter: Pipeline,
pub attr_stack: gix_worktree::Stack,
filter_mode: pipeline::Mode,
diff_cache: HashMap<platform::CacheKey, platform::CacheValue>,
}
mod impls {
use crate::blob::ResourceKind;
impl std::fmt::Display for ResourceKind {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.write_str(match self {
ResourceKind::OldOrSource => "old",
ResourceKind::NewOrDestination => "new",
})
}
}
}