Skip to main content

Module trampoline

Module trampoline 

Source
Expand description

Trampolines for various pyfunction and pymethod implementations.

They exist to monomorphise std::panic::catch_unwind once into PyO3, rather than inline in every function, thus saving a huge amount of compile-time complexity.

Re-exportsΒ§

pub use get_trampoline_function;
pub use self::fastcall_cfunction_with_keywords as maybe_fastcall_cfunction_with_keywords;Py_3_10 or non-Py_LIMITED_API
pub use self::fastcall_cfunction_with_keywords as maybe_fastcall_cfunction_with_keywords;Py_3_10 or non-Py_LIMITED_API

ModulesΒ§

binaryfunc
Companion module contains the function pointer type.
cfunction_with_keywords
Companion module contains the function pointer type.
descrgetfunc
Companion module contains the function pointer type.
fastcall_cfunction_with_keywords
Companion module contains the function pointer type.
getattrofunc
Companion module contains the function pointer type.
getbufferproc
Companion module contains the function pointer type.
getiterfunc
Companion module contains the function pointer type.
hashfunc
Companion module contains the function pointer type.
initproc
Companion module contains the function pointer type.
inquiry
Companion module contains the function pointer type.
iternextfunc
Companion module contains the function pointer type.
lenfunc
Companion module contains the function pointer type.
newfunc
Companion module contains the function pointer type.
noargs
objobjproc
Companion module contains the function pointer type.
releasebufferprocNon-Py_LIMITED_API or Py_3_11
reprfunc
Companion module contains the function pointer type.
richcmpfunc
Companion module contains the function pointer type.
setattrofunc
Companion module contains the function pointer type.
ssizeargfunc
Companion module contains the function pointer type.
ternaryfunc
Companion module contains the function pointer type.
unaryfunc
Companion module contains the function pointer type.

MacrosΒ§

trampoline πŸ”’
Macro to define a trampoline function for a given function signature.
trampolines πŸ”’

TraitsΒ§

MethodDef
A workaround for Rust not allowing function pointers as const generics: define a trait which has a constant function pointer.

FunctionsΒ§

binaryfunc⚠
External symbol called by Python, which calls the provided Rust function.
cfunction_with_keywords⚠
External symbol called by Python, which calls the provided Rust function.
dealloc πŸ”’ ⚠
Safety
descrgetfunc⚠
External symbol called by Python, which calls the provided Rust function.
fastcall_cfunction_with_keywords⚠
External symbol called by Python, which calls the provided Rust function.
getattrofunc⚠
External symbol called by Python, which calls the provided Rust function.
getbufferproc⚠
External symbol called by Python, which calls the provided Rust function.
getiterfunc⚠
External symbol called by Python, which calls the provided Rust function.
hashfunc⚠
External symbol called by Python, which calls the provided Rust function.
initproc⚠
External symbol called by Python, which calls the provided Rust function.
inquiry⚠
External symbol called by Python, which calls the provided Rust function.
iternextfunc⚠
External symbol called by Python, which calls the provided Rust function.
lenfunc⚠
External symbol called by Python, which calls the provided Rust function.
module_exec⚠
newfunc⚠
External symbol called by Python, which calls the provided Rust function.
noargs⚠
Noargs is a special case where the _args parameter is unused and not passed to the inner Func.
objobjproc⚠
External symbol called by Python, which calls the provided Rust function.
panic_result_into_callback_output πŸ”’
Converts the output of std::panic::catch_unwind into a Python function output, either by raising a Python exception or by unwrapping the contained success output.
releasebufferproc⚠Non-Py_LIMITED_API or Py_3_11
Releasebufferproc is a special case where the function cannot return an error, so we use trampoline_unraisable.
reprfunc⚠
External symbol called by Python, which calls the provided Rust function.
richcmpfunc⚠
External symbol called by Python, which calls the provided Rust function.
setattrofunc⚠
External symbol called by Python, which calls the provided Rust function.
ssizeargfunc⚠
External symbol called by Python, which calls the provided Rust function.
ternaryfunc⚠
External symbol called by Python, which calls the provided Rust function.
trampoline πŸ”’ ⚠
Implementation of trampoline functions, which sets up an AttachGuard and calls F.
trampoline_unraisable πŸ”’ ⚠
Implementation of trampoline for functions which can’t return an error.
unaryfunc⚠
External symbol called by Python, which calls the provided Rust function.
⚠️ Internal Docs ⚠️ Not Public API πŸ‘‰ Official Docs Here