[][src]Trait pyo3::pyclass::PyClassSend

pub trait PyClassSend: Sized {
    type ThreadChecker: PyClassThreadChecker<Self>;
}

This trait is implemented for #[pyclass] and handles following two situations:

  1. In case T is Send, stub ThreadChecker is used and does nothing. This implementation is used by default. Compile fails if T: !Send.
  2. In case T is !Send, ThreadChecker panics when T is accessed by another thread. This implementation is used when #[pyclass(unsendable)] is given. Panicking makes it safe to expose T: !Send to the Python interpreter, where all objects can be accessed by multiple threads by threading module.

Associated Types

type ThreadChecker: PyClassThreadChecker<Self>

Loading content...

Implementors

Loading content...