review comments of NativeAccess and RefHandle
@@ -191,10 +191,14 @@ where
}
}
-/// Trait that enables access to a native representation by reference.
-pub(crate) trait NativeAccess<N> {
+/// Trait that enables access to a native representation of a wrapper type.
+pub trait NativeAccess<N> {
+ /// Provides shared access to the native type of the wrapper.
fn native(&self) -> &N;
+
+ /// Provides exclusive access to the native type of the wrapper.
fn native_mut(&mut self) -> &mut N;
+
// Returns a ptr to the native mutable value.
unsafe fn native_mut_force(&self) -> *mut N {
self.native() as *const N as *mut N
@@ -441,8 +445,8 @@ impl<N: NativeDrop> NativeAccess<N> for RefHandle<N> {
impl<N: NativeDrop> RefHandle<N> {
/// Creates a RefHandle from a native pointer.
///
- /// From this time on the RefHandle ownes the object that the pointer points
- /// to and will call it's NativeDrop implementation it it goes out of scope.
+ /// From this time on, the handle owns the object that the pointer points
+ /// to and will call its NativeDrop implementation if it goes out of scope.
pub(crate) fn from_ptr(ptr: *mut N) -> Option<Self> {
ptr.into_option().map(Self)
}
