pyo3_stub_gen::stub_type

Trait PyStubType

source
pub trait PyStubType {
    // Required method
    fn type_output() -> TypeInfo;

    // Provided method
    fn type_input() -> TypeInfo { ... }
}
Expand description

Annotate Rust types with Python type information.

Required Methods§

source

fn type_output() -> TypeInfo

The type to be used in the output signature, i.e. return type of the Python function or methods.

Provided Methods§

source

fn type_input() -> TypeInfo

The type to be used in the input signature, i.e. the arguments of the Python function or methods.

This defaults to the output type, but can be overridden for types that are not valid input types. For example, Vec::<T>::type_output returns list[T] while Vec::<T>::type_input returns typing.Sequence[T].

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl PyStubType for &str

source§

impl PyStubType for Cow<'_, str>

source§

impl PyStubType for Cow<'_, OsStr>

source§

impl PyStubType for bool

source§

impl PyStubType for char

source§

impl PyStubType for f32

source§

impl PyStubType for f64

source§

impl PyStubType for i8

source§

impl PyStubType for i16

source§

impl PyStubType for i32

source§

impl PyStubType for i64

source§

impl PyStubType for i128

source§

impl PyStubType for isize

source§

impl PyStubType for u8

source§

impl PyStubType for u16

source§

impl PyStubType for u32

source§

impl PyStubType for u64

source§

impl PyStubType for u128

source§

impl PyStubType for ()

source§

impl PyStubType for usize

source§

impl PyStubType for String

source§

impl PyStubType for Duration

source§

impl PyStubType for OsStr

source§

impl PyStubType for OsString

source§

impl PyStubType for PathBuf

source§

impl PyStubType for SystemTime

source§

impl PyStubType for NaiveDate

source§

impl PyStubType for NaiveDateTime

source§

impl PyStubType for NaiveTime

source§

impl PyStubType for FixedOffset

source§

impl PyStubType for Utc

source§

impl PyStubType for Duration

source§

impl PyStubType for Complex32

source§

impl PyStubType for Complex64

source§

impl PyStubType for CompareOp

source§

impl PyStubType for PyAny

source§

impl PyStubType for PyBackedBytes

source§

impl PyStubType for PyBackedStr

source§

impl PyStubType for PyByteArray

source§

impl PyStubType for PyBytes

source§

impl PyStubType for PyDict

source§

impl PyStubType for PyFloat

source§

impl PyStubType for PyInt

source§

impl PyStubType for PyList

source§

impl PyStubType for PySet

source§

impl PyStubType for PySlice

source§

impl PyStubType for PyString

source§

impl PyStubType for PyTuple

source§

impl PyStubType for PyType

source§

impl PyStubType for PyUntypedArray

source§

impl<Key: PyStubType, Value: PyStubType> PyStubType for BTreeMap<Key, Value>

source§

impl<Key: PyStubType, Value: PyStubType, State> PyStubType for HashMap<Key, Value, State>

source§

impl<T1: PyStubType, T2: PyStubType> PyStubType for (T1, T2)

source§

impl<T1: PyStubType, T2: PyStubType, T3: PyStubType> PyStubType for (T1, T2, T3)

source§

impl<T1: PyStubType, T2: PyStubType, T3: PyStubType, T4: PyStubType> PyStubType for (T1, T2, T3, T4)

source§

impl<T1: PyStubType, T2: PyStubType, T3: PyStubType, T4: PyStubType, T5: PyStubType> PyStubType for (T1, T2, T3, T4, T5)

source§

impl<T1: PyStubType, T2: PyStubType, T3: PyStubType, T4: PyStubType, T5: PyStubType, T6: PyStubType> PyStubType for (T1, T2, T3, T4, T5, T6)

source§

impl<T1: PyStubType, T2: PyStubType, T3: PyStubType, T4: PyStubType, T5: PyStubType, T6: PyStubType, T7: PyStubType> PyStubType for (T1, T2, T3, T4, T5, T6, T7)

source§

impl<T1: PyStubType, T2: PyStubType, T3: PyStubType, T4: PyStubType, T5: PyStubType, T6: PyStubType, T7: PyStubType, T8: PyStubType> PyStubType for (T1, T2, T3, T4, T5, T6, T7, T8)

source§

impl<T1: PyStubType, T2: PyStubType, T3: PyStubType, T4: PyStubType, T5: PyStubType, T6: PyStubType, T7: PyStubType, T8: PyStubType, T9: PyStubType> PyStubType for (T1, T2, T3, T4, T5, T6, T7, T8, T9)

source§

impl<T: NumPyScalar, D> PyStubType for PyArray<T, D>

source§

impl<T: PyStubType + PyClass> PyStubType for PyRef<'_, T>

source§

impl<T: PyStubType + PyClass<Frozen = False>> PyStubType for PyRefMut<'_, T>

source§

impl<T: PyStubType> PyStubType for Option<T>

source§

impl<T: PyStubType> PyStubType for &T

source§

impl<T: PyStubType> PyStubType for Box<T>

source§

impl<T: PyStubType> PyStubType for BTreeSet<T>

source§

impl<T: PyStubType> PyStubType for Vec<T>

source§

impl<T: PyStubType> PyStubType for Bound<'_, T>

source§

impl<T: PyStubType> PyStubType for Py<T>

source§

impl<T: PyStubType, E> PyStubType for Result<T, E>

source§

impl<T: PyStubType, State> PyStubType for HashSet<T, State>

source§

impl<T: PyStubType, const N: usize> PyStubType for [T; N]

source§

impl<Tz: TimeZone> PyStubType for DateTime<Tz>

Implementors§