pub struct TextRange { /* private fields */ }Expand description
A half-open byte range into the source text.
Ranges are byte offsets, not char offsets. GDScript source is UTF-8 and the lexer only ever splits on ASCII boundaries, so every range produced here is guaranteed to land on a char boundary.
Implementations§
Source§impl TextRange
impl TextRange
pub const fn new(start: u32, end: u32) -> Self
Sourcepub const fn empty(offset: u32) -> Self
pub const fn empty(offset: u32) -> Self
A zero-width range at offset, used for synthetic tokens such as
Indent, Dedent and Eof.
pub const fn start(self) -> u32
pub const fn end(self) -> u32
pub const fn len(self) -> u32
pub const fn is_empty(self) -> bool
Trait Implementations§
impl Copy for TextRange
impl Eq for TextRange
Source§impl Ord for TextRange
impl Ord for TextRange
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialOrd for TextRange
impl PartialOrd for TextRange
impl StructuralPartialEq for TextRange
Auto Trait Implementations§
impl Freeze for TextRange
impl RefUnwindSafe for TextRange
impl Send for TextRange
impl Sync for TextRange
impl Unpin for TextRange
impl UnsafeUnpin for TextRange
impl UnwindSafe for TextRange
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