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§
Sourcefn enter(&mut self) -> Result<T, PythonException>
fn enter(&mut self) -> Result<T, PythonException>
Enter and produce the body value.
Sourcefn exit(
&mut self,
error: Option<&PythonException>,
) -> Result<bool, PythonException>
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".