Trait pyo3::class::context::PyContextProtocol[][src]

pub trait PyContextProtocol<'p>: PyClass {
    fn __enter__(&'p mut self) -> Self::Result
    where
        Self: PyContextEnterProtocol<'p>
, { ... }
fn __exit__(
        &'p mut self,
        exc_type: Option<Self::ExcType>,
        exc_value: Option<Self::ExcValue>,
        traceback: Option<Self::Traceback>
    ) -> Self::Result
    where
        Self: PyContextExitProtocol<'p>
, { ... } }
Expand description

Context manager interface

Provided methods

👎 Deprecated since 0.14.0:

prefer implementing __enter__ in #[pymethods] instead of in a protocol

👎 Deprecated since 0.14.0:

prefer implementing __exit__ in #[pymethods] instead of in a protocol

Implementors