pub enum Element {
FunctionDef {
name: String,
args: Vec<String>,
body: Vec<Element>,
},
ClassDef {
name: String,
bases: Vec<String>,
body: Vec<Element>,
},
Assign {
target: String,
value: String,
},
Expr {
value: String,
},
Import {
module: String,
alias: Option<String>,
},
ImportFrom {
module: String,
names: Vec<String>,
},
Return {
value: Option<String>,
},
If {
test: String,
body: Vec<Element>,
orelse: Vec<Element>,
},
For {
target: String,
iter: String,
body: Vec<Element>,
},
While {
test: String,
body: Vec<Element>,
},
Comment {
text: String,
},
Other {
kind: PythonSyntaxKind,
text: String,
},
}Expand description
Python 语法元素
Variants§
FunctionDef
函数定义
ClassDef
类定义
Assign
赋值语句
Expr
表达式语句
Import
导入语句
ImportFrom
从模块导入
Return
返回语句
If
条件语句
For
循环语句
While
While 循环
Comment
注释
Other
其他元素
Trait Implementations§
impl Eq for Element
impl StructuralPartialEq for Element
Auto Trait Implementations§
impl Freeze for Element
impl RefUnwindSafe for Element
impl Send for Element
impl Sync for Element
impl Unpin for Element
impl UnwindSafe for Element
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