Skip to main content

ContextManager

Trait ContextManager 

Source
pub trait ContextManager<T> {
    // Required methods
    fn enter(&mut self) -> Result<T, PythonException>;
    fn exit(
        &mut self,
        error: Option<&PythonException>,
    ) -> Result<bool, PythonException>;
}
Expand description

Policy seam for Python’s synchronous context-manager protocol.

Required Methods§

Source

fn enter(&mut self) -> Result<T, PythonException>

Enter and produce the body value.

Source

fn exit( &mut self, error: Option<&PythonException>, ) -> Result<bool, PythonException>

Exit after normal or exceptional completion; true suppresses an exception.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§