MCPcopy Index your code
hub / github.com/encounter/objdiff / run_diff

Method run_diff

objdiff-wasm/src/api.rs:60–91  ·  view source on GitHub ↗
(
        left: Option<ObjectBorrow>,
        right: Option<ObjectBorrow>,
        diff_config: DiffConfigBorrow,
        mapping_config: MappingConfig,
    )

Source from the content-addressed store, hash-verified

58 type ObjectDiff = ResourceObjectDiff;
59
60 fn run_diff(
61 left: Option<ObjectBorrow>,
62 right: Option<ObjectBorrow>,
63 diff_config: DiffConfigBorrow,
64 mapping_config: MappingConfig,
65 ) -> Result<DiffResult, String> {
66 let diff_config = diff_config.get::<ResourceDiffConfig>().0.borrow();
67 let mapping_config = diff::MappingConfig::from(mapping_config);
68 log::debug!("Running diff with config: {:?}", diff_config);
69 let result = diff::diff_objs(
70 left.as_ref().map(|o| o.get::<ResourceObject>().0.as_ref()),
71 right.as_ref().map(|o| o.get::<ResourceObject>().0.as_ref()),
72 None,
73 &diff_config,
74 &mapping_config,
75 )
76 .map_err(|e| e.to_string())?;
77 Ok(DiffResult {
78 left: result.left.map(|d| {
79 ObjectDiff::new(ResourceObjectDiff(
80 left.unwrap().get::<ResourceObject>().0.clone(),
81 d,
82 ))
83 }),
84 right: result.right.map(|d| {
85 ObjectDiff::new(ResourceObjectDiff(
86 right.unwrap().get::<ResourceObject>().0.clone(),
87 d,
88 ))
89 }),
90 })
91 }
92}
93
94fn build_regex(s: &str) -> Option<Regex> {

Callers

nothing calls this directly

Calls 2

diff_objsFunction · 0.85
ResourceObjectDiffClass · 0.85

Tested by

no test coverage detected