Skip to content

Instantly share code, notes, and snippets.

View mejrs's full-sized avatar

Bruno Kolenbrander mejrs

  • Delft, Netherlands
View GitHub Profile

This is a collection of of pyo3 errors I'd like to improve.

Trying to misuse Python::allow_threads.

Code:

use pyo3::prelude::*;
use pyo3::types::PyString;

fn parallel_print(py: Python<'_>) {

Have you ever wondered how to create these feature annotations in your documentation?

image

This is done with the doc_cfg feature. However, this is an unstable feature, and it cannot be used on stable Rust. This gist is a guide on how to work around that.

Add the feature

Add this to the top of your lib.rs: