Merge pull request #3697 from davidhewitt/as-gil-ref
expose `Bound::as_gil_ref` and `Bound::into_gil_ref`
This commit is contained in:
commit
ff373eb1c6
|
@ -196,8 +196,9 @@ impl<'py, T> Bound<'py, T> {
|
|||
unsafe { std::mem::transmute(gil_ref) }
|
||||
}
|
||||
|
||||
/// Internal helper to get to pool references for backwards compatibility
|
||||
#[doc(hidden)] // public and doc(hidden) to use in examples and tests for now
|
||||
/// Casts this `Bound<T>` as the corresponding "GIL Ref" type.
|
||||
///
|
||||
/// This is a helper to be used for migration from the deprecated "GIL Refs" API.
|
||||
pub fn as_gil_ref(&'py self) -> &'py T::AsRefTarget
|
||||
where
|
||||
T: HasPyGilRef,
|
||||
|
@ -205,8 +206,10 @@ impl<'py, T> Bound<'py, T> {
|
|||
unsafe { self.py().from_borrowed_ptr(self.as_ptr()) }
|
||||
}
|
||||
|
||||
/// Internal helper to get to pool references for backwards compatibility
|
||||
#[doc(hidden)] // public but hidden, to use for tests for now
|
||||
/// Casts this `Bound<T>` as the corresponding "GIL Ref" type, registering the pointer on the
|
||||
/// [release pool](Python::from_owned_ptr).
|
||||
///
|
||||
/// This is a helper to be used for migration from the deprecated "GIL Refs" API.
|
||||
pub fn into_gil_ref(self) -> &'py T::AsRefTarget
|
||||
where
|
||||
T: HasPyGilRef,
|
||||
|
|
Loading…
Reference in a new issue