Created
March 26, 2019 08:02
-
-
Save cnd/fdcb891909fab26080af77f6da93bb29 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pub struct SChannel<'s> { | |
pub channel: Channel<'s>, | |
} | |
impl<'i> ::std::ops::Deref for SChannel<'i> { | |
type Target = Channel<'i>; | |
fn deref(&self) -> &Channel<'i> { &self.channel } | |
} | |
pub struct Sess<'s> { | |
pub session: &'s Session, | |
pub channel: SChannel<'s>, | |
} | |
rental! { | |
pub mod rentals { | |
use super::*; | |
#[rental] | |
pub struct SSHSession { | |
session_box: Box<ssh2::Session>, | |
sess: Sess<'session_box>, | |
} | |
} | |
} | |
thread_local! { | |
pub static SSH_RENTAL: RefCell<Option<self::rentals::SSHSession>> = { | |
RefCell::new(None) | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment