Struct cxx::SharedPtr [−][src]
#[repr(C)]pub struct SharedPtr<T> where
T: SharedPtrTarget, { /* fields omitted */ }
Binding to C++ std::shared_ptr<T>
.
Implementations
impl<T> SharedPtr<T> where
T: SharedPtrTarget,
[src]
impl<T> SharedPtr<T> where
T: SharedPtrTarget,
[src]pub fn null() -> Self
[src]
Makes a new SharedPtr wrapping a null pointer.
Matches the behavior of default-constructing a std::shared_ptr.
pub fn new(value: T) -> Self where
T: ExternType<Kind = Trivial>,
[src]
T: ExternType<Kind = Trivial>,
Allocates memory on the heap and makes a SharedPtr owner for it.
pub fn is_null(&self) -> bool
[src]
Checks whether the SharedPtr does not own an object.
This is the opposite of std::shared_ptr<T>::operator bool.
pub fn as_ref(&self) -> Option<&T>
[src]
Returns a reference to the object owned by this SharedPtr if any, otherwise None.
pub fn downgrade(self: &SharedPtr<T>) -> WeakPtr<T> where
T: WeakPtrTarget,
[src]
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
impl<T> Clone for SharedPtr<T> where
T: SharedPtrTarget,
[src]
impl<T> Clone for SharedPtr<T> where
T: SharedPtrTarget,
[src]fn clone(&self) -> Self
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl<T> Debug for SharedPtr<T> where
T: Debug + SharedPtrTarget,
[src]
impl<T> Debug for SharedPtr<T> where
T: Debug + SharedPtrTarget,
[src]impl<T> Deref for SharedPtr<T> where
T: SharedPtrTarget,
[src]
impl<T> Deref for SharedPtr<T> where
T: SharedPtrTarget,
[src]impl<T> Display for SharedPtr<T> where
T: Display + SharedPtrTarget,
[src]
impl<T> Display for SharedPtr<T> where
T: Display + SharedPtrTarget,
[src]Auto Trait Implementations
impl<T> RefUnwindSafe for SharedPtr<T> where
T: RefUnwindSafe,
impl<T> RefUnwindSafe for SharedPtr<T> where
T: RefUnwindSafe,
impl<T> UnwindSafe for SharedPtr<T> where
T: UnwindSafe,
impl<T> UnwindSafe for SharedPtr<T> where
T: UnwindSafe,