type_hint_union

Macro type_hint_union 

Source
macro_rules! type_hint_union {
    ($e:expr) => { ... };
    ($l:expr , $($r:expr),+) => { ... };
}
Expand description

Builds the union of multiple type hints

use pyo3::{type_hint_identifier, type_hint_union};
use pyo3::inspect::PyStaticExpr;

const T: PyStaticExpr = type_hint_union!(type_hint_identifier!("builtins", "int"), type_hint_identifier!("builtins", "float"));
assert_eq!(T.to_string(), "int | float");