pub enum PythonType {
Show 24 variants
Int,
Float,
Str,
Bool,
None_,
List(Box<PythonType>),
Dict(Box<PythonType>, Box<PythonType>),
Tuple(Vec<PythonType>),
Optional(Box<PythonType>),
Union(Vec<PythonType>),
Custom(String),
Any,
Callable,
Set(Box<PythonType>),
FrozenSet(Box<PythonType>),
Generator(Box<PythonType>, Box<PythonType>, Box<PythonType>),
AsyncGenerator(Box<PythonType>, Box<PythonType>),
Iterator(Box<PythonType>),
Iterable(Box<PythonType>),
Sequence(Box<PythonType>),
Mapping(Box<PythonType>, Box<PythonType>),
ClassVar(Box<PythonType>),
Final(Box<PythonType>),
Type(Box<PythonType>),
}Expand description
Python type annotation for type-hinted code generation (PEP 484).
Variants§
Int
int
Float
float
Str
str
Bool
bool
None_
None
List(Box<PythonType>)
list[T]
Dict(Box<PythonType>, Box<PythonType>)
dict[K, V]
Tuple(Vec<PythonType>)
tuple[T1, T2, ...]
Optional(Box<PythonType>)
T | None (Optional[T])
Union(Vec<PythonType>)
T1 | T2 | ... (Union)
Custom(String)
User-defined type / class name
Any
Any (typing.Any)
Callable
Callable[[A, B], R]
Set(Box<PythonType>)
set[T]
FrozenSet(Box<PythonType>)
frozenset[T]
Generator(Box<PythonType>, Box<PythonType>, Box<PythonType>)
Generator[Y, S, R]
AsyncGenerator(Box<PythonType>, Box<PythonType>)
AsyncGenerator[Y, S]
Iterator(Box<PythonType>)
Iterator[T]
Iterable(Box<PythonType>)
Iterable[T]
Sequence(Box<PythonType>)
Sequence[T]
Mapping(Box<PythonType>, Box<PythonType>)
Mapping[K, V]
ClassVar(Box<PythonType>)
ClassVar[T]
Final(Box<PythonType>)
Final[T]
Type(Box<PythonType>)
type[T] (the class itself)
Trait Implementations§
Source§impl Clone for PythonType
impl Clone for PythonType
Source§fn clone(&self) -> PythonType
fn clone(&self) -> PythonType
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 Debug for PythonType
impl Debug for PythonType
Source§impl Display for PythonType
impl Display for PythonType
Source§impl Hash for PythonType
impl Hash for PythonType
Source§impl PartialEq for PythonType
impl PartialEq for PythonType
impl Eq for PythonType
impl StructuralPartialEq for PythonType
Auto Trait Implementations§
impl Freeze for PythonType
impl RefUnwindSafe for PythonType
impl Send for PythonType
impl Sync for PythonType
impl Unpin for PythonType
impl UnsafeUnpin for PythonType
impl UnwindSafe for PythonType
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