pub struct LexedToken<'a> {
pub kind: TokenKind,
pub span: Span,
/* private fields */
}Expand description
Token produced by the shell lexer.
Fields§
§kind: TokenKindToken kind used by the parser.
span: SpanSource span covered by the token.
Implementations§
Source§impl<'a> LexedToken<'a>
impl<'a> LexedToken<'a>
Sourcepub fn word_text(&self) -> Option<&str>
pub fn word_text(&self) -> Option<&str>
Borrow the token text when it is a single-segment word token.
Sourcepub fn word_string(&self) -> Option<String>
pub fn word_string(&self) -> Option<String>
Return an owned string containing the token’s word text.
Sourcepub fn word(&self) -> Option<&LexedWord<'a>>
pub fn word(&self) -> Option<&LexedWord<'a>>
Borrow the structured word payload for word-like tokens.
Sourcepub fn source_slice<'b>(&self, source: &'b str) -> Option<&'b str>
pub fn source_slice<'b>(&self, source: &'b str) -> Option<&'b str>
Borrow the original source slice when the token is source-backed and uncooked.
Sourcepub fn fd_value(&self) -> Option<i32>
pub fn fd_value(&self) -> Option<i32>
Return the file-descriptor payload for redirection tokens that carry one.
Sourcepub fn fd_pair_value(&self) -> Option<(i32, i32)>
pub fn fd_pair_value(&self) -> Option<(i32, i32)>
Return the (source_fd, target_fd) payload for descriptor-pair redirections.
Sourcepub fn error_kind(&self) -> Option<LexerErrorKind>
pub fn error_kind(&self) -> Option<LexerErrorKind>
Return the lexer error payload when this token represents TokenKind::Error.
Trait Implementations§
Source§impl<'a> Clone for LexedToken<'a>
impl<'a> Clone for LexedToken<'a>
Source§fn clone(&self) -> LexedToken<'a>
fn clone(&self) -> LexedToken<'a>
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<'a> Debug for LexedToken<'a>
impl<'a> Debug for LexedToken<'a>
Source§impl<'a> PartialEq for LexedToken<'a>
impl<'a> PartialEq for LexedToken<'a>
impl<'a> Eq for LexedToken<'a>
impl<'a> StructuralPartialEq for LexedToken<'a>
Auto Trait Implementations§
impl<'a> Freeze for LexedToken<'a>
impl<'a> RefUnwindSafe for LexedToken<'a>
impl<'a> Send for LexedToken<'a>
impl<'a> Sync for LexedToken<'a>
impl<'a> Unpin for LexedToken<'a>
impl<'a> UnsafeUnpin for LexedToken<'a>
impl<'a> UnwindSafe for LexedToken<'a>
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