Struct cxx::SharedPtr [−][src]
Binding to C++ std::shared_ptr<T>
.
Implementations
impl<T> SharedPtr<T> where
T: SharedPtrTarget,
[src]
T: SharedPtrTarget,
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]
T: SharedPtrTarget,
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]
T: Debug + SharedPtrTarget,
impl<T> Deref for SharedPtr<T> where
T: SharedPtrTarget,
[src]
T: SharedPtrTarget,
impl<T> Display for SharedPtr<T> where
T: Display + SharedPtrTarget,
[src]
T: Display + SharedPtrTarget,
impl<T> Drop for SharedPtr<T> where
T: SharedPtrTarget,
[src]
T: SharedPtrTarget,
impl<T> Send for SharedPtr<T> where
T: Send + Sync + SharedPtrTarget,
[src]
T: Send + Sync + SharedPtrTarget,
impl<T> Sync for SharedPtr<T> where
T: Send + Sync + SharedPtrTarget,
[src]
T: Send + Sync + SharedPtrTarget,
Auto Trait Implementations
impl<T> RefUnwindSafe for SharedPtr<T> where
T: RefUnwindSafe,
T: RefUnwindSafe,
impl<T> Unpin for SharedPtr<T> where
T: Unpin,
T: Unpin,
impl<T> UnwindSafe for SharedPtr<T> where
T: UnwindSafe,
T: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,