pyo3_stub_gen/generate/
variable.rs1use std::fmt;
2
3use crate::{type_info::PyVariableInfo, TypeInfo};
4
5#[derive(Debug, Clone, PartialEq)]
6pub struct VariableDef {
7 pub name: &'static str,
8 pub type_: TypeInfo,
9}
10
11impl From<&PyVariableInfo> for VariableDef {
12 fn from(info: &PyVariableInfo) -> Self {
13 Self {
14 name: info.name,
15 type_: (info.r#type)(),
16 }
17 }
18}
19
20impl fmt::Display for VariableDef {
21 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
22 write!(f, "{}: {}", self.name, self.type_)
23 }
24}