From 19c95e8c79723e22a35de302cb8f768f9d133dbc Mon Sep 17 00:00:00 2001 From: Wez Furlong Date: Tue, 23 Jul 2019 16:34:16 -0700 Subject: Session::new() now returns Result rather than Option Refs: https://github.com/alexcrichton/ssh2-rs/issues/96 This is a breaking change, so bump the package version --- src/session.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/session.rs b/src/session.rs index 71af745..10a0703 100644 --- a/src/session.rs +++ b/src/session.rs @@ -36,14 +36,14 @@ impl Session { /// mode, compression, sigpipe, the banner, etc. To associate this session /// with a TCP connection, use the `handshake` method to pass in an /// already-established TCP socket. - pub fn new() -> Option { + pub fn new() -> Result { ::init(); unsafe { let ret = raw::libssh2_session_init_ex(None, None, None, 0 as *mut _); if ret.is_null() { - None + Err(Error::unknown()) } else { - Some(Binding::from_raw(ret)) + Ok(Binding::from_raw(ret)) } } } -- cgit v1.2.3