Skip to main content

Module utils

Module utils 

Source

Macrosยง

bail_spanned ๐Ÿ”’
Macro inspired by anyhow::bail! to return a compiler error with the given span.
ensure_spanned ๐Ÿ”’
Macro inspired by anyhow::ensure! to return a compiler error with the given span if the specified condition is not met.
err_spanned ๐Ÿ”’
Macro inspired by anyhow::anyhow! to create a compiler error with the given span.

Structsยง

Ctx
PythonDoc
A syntax tree which evaluates to a string for Python.
StaticIdent
Helper struct for hard-coded identifiers used in the macro code.

Enumsยง

IdentOrStr ๐Ÿ”’
PyO3CratePath
StrOrExpr
A plain string or an expression

Functionsยง

apply_renaming_rule
expr_to_python
get_doc
Collects all #[doc = โ€œโ€ฆโ€] attributes into a TokenStream evaluating to a string.
has_attribute ๐Ÿ”’
has_attribute_with_namespace ๐Ÿ”’
is_python
Check if the given type ty is pyo3::Python.
locate_tokens_at ๐Ÿ”’
Adjusts a tokes stream so that the location for the stream comes from Span.
option_type_argument
If ty is Option<T>, return Some(T), else None.
unwrap_ty_group
โš ๏ธ Internal Docs โš ๏ธ Not Public API ๐Ÿ‘‰ Official Docs Here