pub struct BoundContextWatcherGuard<'py> { /* private fields */ }Expand description
A Python-bound guard which keeps a context watcher registered.
The watcher is registered for the current Python interpreter and is removed when this guard is
dropped. Use clear to remove it explicitly and observe any error returned by
CPython.
This guard is bound to the Python attachment used to create it. It therefore cannot be sent
to another thread, moved outside that attachment, or moved into Python::detach.
Use unbind to convert this guard into a ContextWatcherGuard which can be
stored outside the current attachment.
Implementations§
Source§impl BoundContextWatcherGuard<'_>
impl BoundContextWatcherGuard<'_>
Sourcepub fn clear(self) -> PyResult<()>
pub fn clear(self) -> PyResult<()>
Removes this watcher from the current Python interpreter.
Dropping the guard also removes the watcher, but cannot report a failure to the caller.
Sourcepub fn unbind(self) -> ContextWatcherGuard
pub fn unbind(self) -> ContextWatcherGuard
Removes the connection to the current Python attachment, allowing the guard to be stored outside it or sent to another thread.
Dropping the returned guard automatically attaches to Python to remove the watcher. To avoid
that attachment, convert it back with ContextWatcherGuard::into_bound before dropping it,
or call ContextWatcherGuard::clear while attached.
Trait Implementations§
Source§impl Drop for BoundContextWatcherGuard<'_>
Available on Py_3_14 and non-Py_GIL_DISABLED only.
impl Drop for BoundContextWatcherGuard<'_>
Py_3_14 and non-Py_GIL_DISABLED only.Auto Trait Implementations§
impl<'py> !Send for BoundContextWatcherGuard<'py>
impl<'py> !Sync for BoundContextWatcherGuard<'py>
impl<'py> Freeze for BoundContextWatcherGuard<'py>
impl<'py> RefUnwindSafe for BoundContextWatcherGuard<'py>
impl<'py> Unpin for BoundContextWatcherGuard<'py>
impl<'py> UnsafeUnpin for BoundContextWatcherGuard<'py>
impl<'py> UnwindSafe for BoundContextWatcherGuard<'py>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more