From 38abfd2eedf4be7c2e38c2436f449e9368522ff0 Mon Sep 17 00:00:00 2001 From: David Hewitt Date: Sun, 24 Dec 2023 14:34:08 +0000 Subject: [PATCH] expose `Bound::as_gil_ref` and `Bound::into_gil_ref` --- src/instance.rs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/instance.rs b/src/instance.rs index c3de539a..68bc0b5d 100644 --- a/src/instance.rs +++ b/src/instance.rs @@ -183,8 +183,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` 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, @@ -192,8 +193,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` 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,