1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
//! Anchor matching for the `workspace_edit` replace variant: byte-exact
//! match counting, bounded line-number reporting, and the sha256 digest the
//! refusal and the result carry. Pure helpers — no filesystem contact — so
//! the tool body stays small and these stay unit-testable.
use ;
/// Excerpt budget for an ambiguous-anchor refusal: the error carries bounded
/// line numbers only, never excerpts — this cap bounds how many line numbers
/// are reported.
pub const WORKSPACE_EDIT_MAX_REPORTED_LINES: usize = 16;
/// Byte offsets of every non-overlapping occurrence of `needle` in `text`.
/// Both are `&str`, so every match boundary is a char boundary and the
/// offsets are valid byte-range ends for the splice. Byte-exact: no
/// normalization, no fuzzy fallback, ever.
pub
/// 1-based line numbers for the first few match offsets, bounded so the
/// refusal carries lines — never excerpts, never file content.
pub
/// Lowercase hex sha256 of the file's bytes — the digest the refusal and
/// the result carry, and the value an `expected_digest` precondition states.
pub