pub struct Anchor {
pub file: String,
pub line: Option<u32>,
pub line_end: Option<u32>,
pub on_old_side: bool,
pub line_text: Option<String>,
}Expand description
Where a comment is anchored. line (and line_end for visual ranges)
is the new-side line number unless the line is a deletion, then it is
the old-side number with on_old_side.
Fields§
§file: String§line: Option<u32>§line_end: Option<u32>§on_old_side: bool§line_text: Option<String>Snapshot of the anchored line’s text, so the UI can mark the comment outdated when the agent rewrites the line.
Implementations§
Source§impl Anchor
impl Anchor
Sourcepub fn span(&self) -> Option<(u32, u32)>
pub fn span(&self) -> Option<(u32, u32)>
The rows this anchor covers, on whichever side it names: line
through line_end (or just line for a point anchor). None for a
file-level anchor with no line at all.
Sourcepub fn is_outdated(&self, model: &DiffModel) -> bool
pub fn is_outdated(&self, model: &DiffModel) -> bool
Whether the anchor no longer matches the model. Range comments
anchor to their end line: that is the line whose disappearance or
line_text drift marks them outdated. A line-less anchor is
outdated only once the whole file leaves the diff.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Anchor
impl<'de> Deserialize<'de> for Anchor
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for Anchor
impl StructuralPartialEq for Anchor
Auto Trait Implementations§
impl Freeze for Anchor
impl RefUnwindSafe for Anchor
impl Send for Anchor
impl Sync for Anchor
impl Unpin for Anchor
impl UnsafeUnpin for Anchor
impl UnwindSafe for Anchor
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more