Skip to main content

preview

Function preview 

Source
pub fn preview(original: &str, args: &Value, display: &str) -> Result<String>
Expand description

The content edit_file with args would leave in a file holding original: the replacements of args applied in order, or the error the call would fail with (spec 3.1 §7.26: a reviewer sees the edit before it runs).

§Errors

Returns the argument, no-match or ambiguity error the call would return.

§Example

use serde_json::json;

let args = json!({ "path": "a.rs", "edits": [
    { "old_string": "one", "new_string": "1" },
    { "old_string": "two", "new_string": "2" }
] });
assert_eq!(adk_devtools::tools::edit::preview("one two", &args, "a.rs").unwrap(), "1 2");