pub struct Input { /* private fields */ }Expand description
Read-only original input and its byte-preserving parser view.
Implementations§
Source§impl Input
impl Input
pub fn parse(bytes: Vec<u8>, mode: FileMode) -> Result<Self, InputError>
Sourcepub fn parse_named(
bytes: Vec<u8>,
mode: FileMode,
file: impl Into<String>,
) -> Result<Self, InputError>
pub fn parse_named( bytes: Vec<u8>, mode: FileMode, file: impl Into<String>, ) -> Result<Self, InputError>
Parse original bytes with the file identity used by inspection output.
pub fn file(&self) -> &str
pub fn source_bytes(&self) -> &[u8] ⓘ
Sourcepub fn syntax(&self) -> &ParsedFile
pub fn syntax(&self) -> &ParsedFile
The analysis CST uses offsets after any leading BOM. Use token_range
and selected item ranges for coordinates in the original input.
pub fn syntax_offset(&self) -> usize
pub fn token_range(&self, index: usize) -> Range<usize> ⓘ
pub fn token_bytes(&self, index: usize) -> &[u8] ⓘ
pub fn line_column(&self, offset: usize) -> (usize, usize)
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for Input
impl RefUnwindSafe for Input
impl Send for Input
impl Sync for Input
impl Unpin for Input
impl UnsafeUnpin for Input
impl UnwindSafe for Input
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