pub struct GPtr<T: RefCounted> { /* private fields */ }
Expand description
Similar to Arc
, but does not call release
while the reference count is
greater than or equal to zero.
It differs from Arc
in that it does not have its own reference-counting field. In other words, it manipulates the pointer it holds via an external reference count and drop implementation.
Implementations§
Source§impl<T: RefCounted> GPtr<T>
impl<T: RefCounted> GPtr<T>
pub const fn new(ptr: *mut T) -> Self
pub const fn null() -> Self
pub fn from_raw(ptr: *mut T) -> Self
pub fn reset(&mut self)
pub fn reset_with(&mut self, ptr: *mut T)
pub const fn get(&self) -> *mut T
pub const fn as_ref(&self) -> Option<&T>
pub const fn as_mut(&mut self) -> Option<&mut T>
pub fn cast<U>(self) -> GPtr<U>where
U: RefCounted,
Trait Implementations§
Source§impl<T: RefCounted> Clone for GPtr<T>
impl<T: RefCounted> Clone for GPtr<T>
Source§impl<T: RefCounted> Default for GPtr<T>
impl<T: RefCounted> Default for GPtr<T>
Source§impl<T: RefCounted> Deref for GPtr<T>
impl<T: RefCounted> Deref for GPtr<T>
Source§impl<T: RefCounted> DerefMut for GPtr<T>
impl<T: RefCounted> DerefMut for GPtr<T>
Source§impl<T: RefCounted> Drop for GPtr<T>
impl<T: RefCounted> Drop for GPtr<T>
Source§impl<T: RefCounted> PartialEq for GPtr<T>
impl<T: RefCounted> PartialEq for GPtr<T>
impl<T: RefCounted> Eq for GPtr<T>
Auto Trait Implementations§
impl<T> Freeze for GPtr<T>
impl<T> RefUnwindSafe for GPtr<T>where
T: RefUnwindSafe,
impl<T> !Send for GPtr<T>
impl<T> !Sync for GPtr<T>
impl<T> Unpin for GPtr<T>
impl<T> UnwindSafe for GPtr<T>where
T: RefUnwindSafe,
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
Mutably borrows from an owned value. Read more