mirror of
https://github.com/astral-sh/ruff
synced 2026-01-21 21:40:51 -05:00
35 lines
637 B
Rust
35 lines
637 B
Rust
use std::borrow::Cow;
|
|
|
|
use rustpython_ast::{Expr, Stmt};
|
|
|
|
#[derive(Debug, Clone)]
|
|
pub enum DefinitionKind<'a> {
|
|
Module,
|
|
Package,
|
|
Class(&'a Stmt),
|
|
NestedClass(&'a Stmt),
|
|
Function(&'a Stmt),
|
|
NestedFunction(&'a Stmt),
|
|
Method(&'a Stmt),
|
|
}
|
|
|
|
#[derive(Debug)]
|
|
pub struct Definition<'a> {
|
|
pub kind: DefinitionKind<'a>,
|
|
pub docstring: Option<&'a Expr>,
|
|
}
|
|
|
|
#[derive(Debug)]
|
|
pub struct Docstring<'a> {
|
|
pub kind: DefinitionKind<'a>,
|
|
pub expr: &'a Expr,
|
|
pub contents: &'a Cow<'a, str>,
|
|
pub body: &'a str,
|
|
pub indentation: &'a Cow<'a, str>,
|
|
}
|
|
|
|
pub enum Documentable {
|
|
Class,
|
|
Function,
|
|
}
|