pub struct ScannedSource { /* private fields */ }Expand description
The immutable product of one lexical pass over a source file.
It retains the file identity, the ScriptKind, the shared source text, the
non-EOF tokens in lexical order (including trivia), and the terminal
end-of-file token whose empty range anchors the end of the source.
Implementations§
Source§impl ScannedSource
impl ScannedSource
Sourcepub const fn script_kind(&self) -> ScriptKind
pub const fn script_kind(&self) -> ScriptKind
Returns the syntax the source was scanned as.
Sourcepub fn source(&self) -> &Arc<SourceText>
pub fn source(&self) -> &Arc<SourceText>
Returns the shared, immutable source text.
Sourcepub fn source_text(&self) -> &SourceText
pub fn source_text(&self) -> &SourceText
Returns the source text mapper directly.
Sourcepub fn tokens(&self) -> &[Token]
pub fn tokens(&self) -> &[Token]
Returns the non-EOF tokens in lexical order, including trivia.
Sourcepub fn token_text(&self, token: &Token) -> Option<&str>
pub fn token_text(&self, token: &Token) -> Option<&str>
Returns the zero-copy lexeme for one token of this source.
None identifies a range that is not a valid UTF-16 slice of this file,
which cannot arise from a scanner-produced token.
Trait Implementations§
Source§impl Clone for ScannedSource
impl Clone for ScannedSource
Source§fn clone(&self) -> ScannedSource
fn clone(&self) -> ScannedSource
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for ScannedSource
impl RefUnwindSafe for ScannedSource
impl Send for ScannedSource
impl Sync for ScannedSource
impl Unpin for ScannedSource
impl UnsafeUnpin for ScannedSource
impl UnwindSafe for ScannedSource
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