pub struct ScopeRange {
pub start_line: u32,
pub end_line: u32,
pub kind: ScopeKind,
pub display_text: String,
pub name: Option<String>,
}Expand description
A scope boundary range in the buffer.
Represents a contiguous region of source code that defines a scope boundary, identified by the syntax driver. Lines are 0-indexed.
§Example
use reovim_driver_syntax::{ScopeRange, ScopeKind};
let scope = ScopeRange::new(5, 20, ScopeKind::Function, "fn main", Some("main".to_string()));
assert!(scope.contains_line(10));
assert!(scope.is_multiline());
assert_eq!(scope.line_count(), 16);Fields§
§start_line: u32Starting line (0-indexed).
end_line: u32Ending line (0-indexed, inclusive).
kind: ScopeKindKind of scope.
display_text: StringDisplay text (e.g., “fn main”, “impl Foo”, “H2 Architecture”).
name: Option<String>Just the identifier name (e.g., “main”, “Foo”), if available.
Implementations§
Source§impl ScopeRange
impl ScopeRange
Sourcepub fn new(
start_line: u32,
end_line: u32,
kind: ScopeKind,
display_text: impl Into<String>,
name: Option<String>,
) -> Self
pub fn new( start_line: u32, end_line: u32, kind: ScopeKind, display_text: impl Into<String>, name: Option<String>, ) -> Self
Create a new scope range.
Sourcepub const fn contains_line(&self, line: u32) -> bool
pub const fn contains_line(&self, line: u32) -> bool
Check if this scope contains a line.
Sourcepub const fn line_count(&self) -> u32
pub const fn line_count(&self) -> u32
Get the number of lines in this scope.
Sourcepub const fn is_multiline(&self) -> bool
pub const fn is_multiline(&self) -> bool
Check if this scope spans multiple lines.
Trait Implementations§
Source§impl Clone for ScopeRange
impl Clone for ScopeRange
Source§fn clone(&self) -> ScopeRange
fn clone(&self) -> ScopeRange
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ScopeRange
impl Debug for ScopeRange
Source§impl PartialEq for ScopeRange
impl PartialEq for ScopeRange
impl Eq for ScopeRange
impl StructuralPartialEq for ScopeRange
Auto Trait Implementations§
impl Freeze for ScopeRange
impl RefUnwindSafe for ScopeRange
impl Send for ScopeRange
impl Sync for ScopeRange
impl Unpin for ScopeRange
impl UnsafeUnpin for ScopeRange
impl UnwindSafe for ScopeRange
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