pub struct CodeSpan {
    pub src: InputSrc,
    pub start: Loc,
    pub end: Loc,
}Expand description
A span in a Uiua source file
Fields§
§src: InputSrcThe path of the file
start: LocThe starting location
end: LocThe ending location
Implementations§
Source§impl CodeSpan
 
impl CodeSpan
Sourcepub fn char_count(&self) -> u32
 
pub fn char_count(&self) -> u32
Get the number of characters in the span
Sourcepub fn merge_with(&mut self, end: Self)
 
pub fn merge_with(&mut self, end: Self)
Merge two spans
Sourcepub fn byte_range(&self) -> Range<usize>
 
pub fn byte_range(&self) -> Range<usize>
Get the text of the span
Sourcepub fn contains_line_col(&self, line: usize, col: usize) -> bool
 
pub fn contains_line_col(&self, line: usize, col: usize) -> bool
Check if the span contains a line and column
Excludes the end column
Sourcepub fn contains_line_col_end(&self, line: usize, col: usize) -> bool
 
pub fn contains_line_col_end(&self, line: usize, col: usize) -> bool
Check if the span contains a line and column
Includes the end column
Sourcepub fn as_str<T>(&self, inputs: &Inputs, f: impl FnOnce(&str) -> T) -> T
 
pub fn as_str<T>(&self, inputs: &Inputs, f: impl FnOnce(&str) -> T) -> T
Get the text of the span from the inputs
Sourcepub fn before_str<T>(&self, inputs: &Inputs, f: impl FnOnce(&str) -> T) -> T
 
pub fn before_str<T>(&self, inputs: &Inputs, f: impl FnOnce(&str) -> T) -> T
Get the text before the span from the inputs
Sourcepub fn try_as_str<T>(
    &self,
    inputs: &Inputs,
    f: impl FnOnce(&str) -> T,
) -> Option<T>
 
pub fn try_as_str<T>( &self, inputs: &Inputs, f: impl FnOnce(&str) -> T, ) -> Option<T>
Get the text of the span from the inputs
Sourcepub fn just_start(&self, inputs: &Inputs) -> Self
 
pub fn just_start(&self, inputs: &Inputs) -> Self
Get just the span of the first character
Trait Implementations§
Source§impl<'de> Deserialize<'de> for CodeSpan
 
impl<'de> Deserialize<'de> for CodeSpan
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
Source§impl Ord for CodeSpan
 
impl Ord for CodeSpan
Source§impl PartialOrd for CodeSpan
 
impl PartialOrd for CodeSpan
impl Eq for CodeSpan
impl StructuralPartialEq for CodeSpan
Auto Trait Implementations§
impl Freeze for CodeSpan
impl RefUnwindSafe for CodeSpan
impl Send for CodeSpan
impl Sync for CodeSpan
impl Unpin for CodeSpan
impl UnwindSafe for CodeSpan
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