Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Export diff module stuff #24

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
10 changes: 5 additions & 5 deletions src/diff.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use crate::{CompareMode, Config, NumericMode};
use serde_json::Value;
use std::{collections::HashSet, fmt};

pub(crate) fn diff<'a>(lhs: &'a Value, rhs: &'a Value, config: Config) -> Vec<Difference<'a>> {
pub fn diff<'a>(lhs: &'a Value, rhs: &'a Value, config: Config) -> Vec<Difference<'a>> {
let mut acc = vec![];
diff_with(lhs, rhs, config, Path::Root, &mut acc);
acc
Expand Down Expand Up @@ -201,8 +201,8 @@ impl<'a, 'b> DiffFolder<'a, 'b> {
}

#[derive(Debug, PartialEq)]
pub(crate) struct Difference<'a> {
path: Path<'a>,
pub struct Difference<'a> {
pub path: Path<'a>,
lhs: Option<&'a Value>,
rhs: Option<&'a Value>,
config: Config,
Expand Down Expand Up @@ -253,7 +253,7 @@ impl<'a> fmt::Display for Difference<'a> {
}

#[derive(Debug, Clone, PartialEq)]
enum Path<'a> {
pub enum Path<'a> {
Root,
Keys(Vec<Key<'a>>),
}
Expand Down Expand Up @@ -286,7 +286,7 @@ impl<'a> fmt::Display for Path<'a> {
}

#[derive(Debug, Copy, Clone, PartialEq)]
enum Key<'a> {
pub enum Key<'a> {
Idx(usize),
Field(&'a str),
}
Expand Down
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ use diff::diff;
use serde::Serialize;

mod core_ext;
mod diff;
pub mod diff;

/// Compare two JSON values for an inclusive match.
///
Expand Down