Trait python_ast::ast::node::Node
source · pub trait Node {
// Provided methods
fn lineno(&self) -> Option<usize> { ... }
fn col_offset(&self) -> Option<usize> { ... }
fn end_lineno(&self) -> Option<usize> { ... }
fn end_col_offset(&self) -> Option<usize> { ... }
fn error_message<S1: Into<String>, S2: Into<String>>(
&self,
mod_name: S1,
message: S2
) -> String { ... }
}
Expand description
A trait for AST elements that represent a position in a source file. Implementing this trait allows an ergonomic means of extracting line and column information from an item.
Provided Methods§
sourcefn lineno(&self) -> Option<usize>
fn lineno(&self) -> Option<usize>
A method for getting the starting line number of the node. This may not exist for all node types.
sourcefn col_offset(&self) -> Option<usize>
fn col_offset(&self) -> Option<usize>
A method for getting the starting column of the node. This may not exist for all node types.
sourcefn end_lineno(&self) -> Option<usize>
fn end_lineno(&self) -> Option<usize>
A method for getting the ending line number of the node. This may not exist for all node types.
sourcefn end_col_offset(&self) -> Option<usize>
fn end_col_offset(&self) -> Option<usize>
A method for getting the ending column of the node. This may not exist for all node types.
Object Safety§
Implementations on Foreign Types§
source§impl Node for PyAny
impl Node for PyAny
source§fn lineno(&self) -> Option<usize>
fn lineno(&self) -> Option<usize>
A method for getting the starting line number of the node. This may not exist for all node types.
source§fn col_offset(&self) -> Option<usize>
fn col_offset(&self) -> Option<usize>
A method for getting the starting column of the node. This may not exist for all node types.
source§fn end_lineno(&self) -> Option<usize>
fn end_lineno(&self) -> Option<usize>
A method for getting the ending line number of the node. This may not exist for all node types.
source§fn end_col_offset(&self) -> Option<usize>
fn end_col_offset(&self) -> Option<usize>
A method for getting the ending column of the node. This may not exist for all node types.