pub struct BoundContextWatcherGuard<'py> {
watcher_id: c_int,
py: Python<'py>,
active: bool,
}Py_3_14 and neither GraalPy nor Py_LIMITED_API nor PyPy nor RustPython and non-Py_GIL_DISABLED only.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.
Fields§
§watcher_id: c_int§py: Python<'py>§active: boolImplementations§
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<'_>
impl Drop for BoundContextWatcherGuard<'_>
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 moreSource§impl<T> SizeHint for Twhere
T: ?Sized,
impl<T> SizeHint for Twhere
T: ?Sized,
Source§default fn lower_bound(&self) -> usize
default fn lower_bound(&self) -> usize
core_io_internals)[u8; 12] could return any value between 0 and
12 inclusively as a correct implementation. Read moreSource§impl<T> SizedTypeProperties for T
impl<T> SizedTypeProperties for T
Source§#[doc(hidden)]const SIZE: usize = _
#[doc(hidden)]const SIZE: usize = _
sized_type_properties)Source§#[doc(hidden)]const ALIGN: usize = _
#[doc(hidden)]const ALIGN: usize = _
sized_type_properties)Source§#[doc(hidden)]const ALIGNMENT: Alignment = _
#[doc(hidden)]const ALIGNMENT: Alignment = _
ptr_alignment_type)Source§#[doc(hidden)]const IS_ZST: bool = _
#[doc(hidden)]const IS_ZST: bool = _
sized_type_properties)Source§#[doc(hidden)]const LAYOUT: Layout = _
#[doc(hidden)]const LAYOUT: Layout = _
sized_type_properties)Source§#[doc(hidden)]const MAX_SLICE_LEN: usize = _
#[doc(hidden)]const MAX_SLICE_LEN: usize = _
sized_type_properties)[Self]. Read more