#[repr(C)]pub struct SharedPtr<T>where
    T: SharedPtrTarget,{ /* private fields */ }Expand description
Binding to C++ std::shared_ptr<T>.
Implementations§
Sourcepub fn null() -> SharedPtr<T>
 
pub fn null() -> SharedPtr<T>
Makes a new SharedPtr wrapping a null pointer.
Matches the behavior of default-constructing a std::shared_ptr.
Sourcepub fn new(value: T) -> SharedPtr<T>where
    T: ExternType<Kind = Trivial>,
 
pub fn new(value: T) -> SharedPtr<T>where
    T: ExternType<Kind = Trivial>,
Allocates memory on the heap and makes a SharedPtr owner for it.
Sourcepub fn is_null(&self) -> bool
 
pub fn is_null(&self) -> bool
Checks whether the SharedPtr does not own an object.
This is the opposite of std::shared_ptr<T>::operator bool.
Sourcepub fn as_ref(&self) -> Option<&T>
 
pub fn as_ref(&self) -> Option<&T>
Returns a reference to the object owned by this SharedPtr if any, otherwise None.
Sourcepub fn downgrade(&self) -> WeakPtr<T>where
    T: WeakPtrTarget,
 
pub fn downgrade(&self) -> WeakPtr<T>where
    T: WeakPtrTarget,
Constructs new WeakPtr as a non-owning reference to the object managed
by self. If self manages no object, the WeakPtr manages no object
too.
Matches the behavior of std::weak_ptr<T>::weak_ptr(const std::shared_ptr<T> &).
Trait Implementations§
Auto Trait Implementations§
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
Source§impl<T> CloneToUninit for Twhere
    T: Clone,
 
impl<T> CloneToUninit for Twhere
    T: Clone,
Source§impl<T> Instrument for T
 
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
 
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
 
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> Pointable for T
 
impl<T> Pointable for T
Source§impl<T> PolicyExt for Twhere
    T: ?Sized,
 
impl<T> PolicyExt for Twhere
    T: ?Sized,
Source§impl<T> PowerToOwned for T
 
impl<T> PowerToOwned for T
Source§impl<T> ToStringFallible for Twhere
    T: Display,
 
impl<T> ToStringFallible for Twhere
    T: Display,
Source§fn try_to_string(&self) -> Result<String, TryReserveError>
 
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.