archway 0.4.0

Rust traits for Rc and Arc interoperation
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
use crate::shared::AnySharedPointer;

/// Trait for a weak pointer
pub trait AnyWeakPointer<T: ?Sized>: Sized {
    /// Corresponding shared pointer type
    type Shared: AnySharedPointer<T>;

    /// Return `self` upgraded to a shared pointer, or `None` if unsuccessful.
    fn upgrade(&self) -> Option<Self::Shared>;
}

/// Unwrapped return type for the `upgrade` function of the [`AnyWeakPointer<T>`] type `P`
pub type Upgraded<P, T> = <P as AnyWeakPointer<T>>::Shared;