MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / new_range

Method new_range

atomic-core/src/diff/word.rs:203–210  ·  view source on GitHub ↗

Get the new range if this operation references new tokens. Returns `Some(range)` for Equal, Insert, and Replace operations. Returns `None` for Delete operations.

(&self)

Source from the content-addressed store, hash-verified

201 /// Returns `Some(range)` for Equal, Insert, and Replace operations.
202 /// Returns `None` for Delete operations.
203 pub fn new_range(&self) -> Option<Range<usize>> {
204 match self {
205 WordDiffOp::Equal { new_range, .. } => Some(new_range.clone()),
206 WordDiffOp::Insert { new_range, .. } => Some(new_range.clone()),
207 WordDiffOp::Replace { new_range, .. } => Some(new_range.clone()),
208 WordDiffOp::Delete { .. } => None,
209 }
210 }
211
212 /// Get the number of old tokens affected by this operation.
213 pub fn old_len(&self) -> usize {

Callers

nothing calls this directly

Calls 1

cloneMethod · 0.45

Tested by

no test coverage detected