core API: SessionWeak.try_upgrade(), SessionWeak.upgrade()

This commit is contained in:
awiouy 2018-02-10 10:22:03 +01:00
parent ae85e69aca
commit 55f27a9e0a

View file

@ -213,11 +213,11 @@ impl Session {
pub struct SessionWeak(pub Weak<SessionInternal>);
impl SessionWeak {
pub fn try_upgrade(&self) -> Option<Session> {
fn try_upgrade(&self) -> Option<Session> {
self.0.upgrade().map(Session)
}
pub fn upgrade(&self) -> Session {
pub(crate) fn upgrade(&self) -> Session {
self.try_upgrade().expect("Session died")
}
}