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

Method old_range

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

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

(&self)

Source from the content-addressed store, hash-verified

188 /// Returns `Some(range)` for Equal, Delete, and Replace operations.
189 /// Returns `None` for Insert operations.
190 pub fn old_range(&self) -> Option<Range<usize>> {
191 match self {
192 WordDiffOp::Equal { old_range, .. } => Some(old_range.clone()),
193 WordDiffOp::Delete { old_range, .. } => Some(old_range.clone()),
194 WordDiffOp::Replace { old_range, .. } => Some(old_range.clone()),
195 WordDiffOp::Insert { .. } => None,
196 }
197 }
198
199 /// Get the new range if this operation references new tokens.
200 ///

Callers

nothing calls this directly

Calls 1

cloneMethod · 0.45

Tested by

no test coverage detected