diff options
author | Alex Crichton <alex@alexcrichton.com> | 2014-12-19 08:34:03 -0800 |
---|---|---|
committer | Alex Crichton <alex@alexcrichton.com> | 2014-12-19 08:34:17 -0800 |
commit | c6998c5c338451892d5d6771603b9d69f58842bd (patch) | |
tree | a12a2de6d04000a65cf6509fc57b64f9644685e8 | |
parent | 4a1ad3717c6a38d2dfc07806c5a5069c58a92288 (diff) | |
download | ssh2-rs-c6998c5c338451892d5d6771603b9d69f58842bd.zip |
Update to rust master
-rw-r--r-- | Cargo.toml | 2 | ||||
-rw-r--r-- | src/agent.rs | 24 | ||||
-rw-r--r-- | src/knownhosts.rs | 26 |
3 files changed, 25 insertions, 27 deletions
@@ -1,6 +1,6 @@ [package] name = "ssh2" -version = "0.1.0" +version = "0.1.1" authors = ["Alex Crichton <alex@alexcrichton.com>"] license = "MIT/Apache-2.0" keywords = ["ssh"] diff --git a/src/agent.rs b/src/agent.rs index 130f817..0083443 100644 --- a/src/agent.rs +++ b/src/agent.rs @@ -8,28 +8,28 @@ use {raw, Session, Error}; /// A structure representing a connection to an SSH agent. /// /// Agents can be used to authenticate a session. -pub struct Agent<'a> { +pub struct Agent<'sess> { raw: *mut raw::LIBSSH2_AGENT, - sess: &'a Session, + sess: &'sess Session, marker: marker::NoSync, } /// An iterator over the identities found in an SSH agent. -pub struct Identities<'a> { +pub struct Identities<'agent> { prev: *mut raw::libssh2_agent_publickey, - agent: &'a Agent<'a>, + agent: &'agent Agent<'agent>, } /// A public key which is extracted from an SSH agent. -pub struct PublicKey<'a> { +pub struct PublicKey<'agent> { raw: *mut raw::libssh2_agent_publickey, marker1: marker::NoSync, marker2: marker::NoSend, - marker3: marker::ContravariantLifetime<'a>, + marker3: marker::ContravariantLifetime<'agent>, marker4: marker::NoCopy, } -impl<'a> Agent<'a> { +impl<'sess> Agent<'sess> { /// Wraps a raw pointer in a new Agent structure tied to the lifetime of the /// given session. /// @@ -86,8 +86,8 @@ impl<'a> Drop for Agent<'a> { } } -impl<'a> Iterator<Result<PublicKey<'a>, Error>> for Identities<'a> { - fn next(&mut self) -> Option<Result<PublicKey<'a>, Error>> { +impl<'agent> Iterator<Result<PublicKey<'agent>, Error>> for Identities<'agent> { + fn next(&mut self) -> Option<Result<PublicKey<'agent>, Error>> { unsafe { let mut next = 0 as *mut _; match raw::libssh2_agent_get_identity(self.agent.raw, @@ -101,13 +101,13 @@ impl<'a> Iterator<Result<PublicKey<'a>, Error>> for Identities<'a> { } } -impl<'a> PublicKey<'a> { +impl<'agent> PublicKey<'agent> { /// Creates a new public key from its raw counterpart. /// /// Unsafe because the validity of `raw` cannot be guaranteed and there are /// no restrictions on the lifetime returned. - pub unsafe fn from_raw<'a>(raw: *mut raw::libssh2_agent_publickey) - -> PublicKey<'a> { + pub unsafe fn from_raw(raw: *mut raw::libssh2_agent_publickey) + -> PublicKey<'agent> { PublicKey { raw: raw, marker1: marker::NoSync, diff --git a/src/knownhosts.rs b/src/knownhosts.rs index 0aa8427..52ee3b1 100644 --- a/src/knownhosts.rs +++ b/src/knownhosts.rs @@ -43,28 +43,27 @@ use {raw, Session, Error, KnownHostFileKind, CheckResult}; /// known_hosts.write_file(&file, KnownHostFileKind::OpenSSH).unwrap(); /// } /// ``` -pub struct KnownHosts<'a> { +pub struct KnownHosts<'sess> { raw: *mut raw::LIBSSH2_KNOWNHOSTS, - sess: &'a Session, + sess: &'sess Session, marker: marker::NoSync, } /// Iterator over the hosts in a `KnownHosts` structure. -pub struct Hosts<'a> { +pub struct Hosts<'kh> { prev: *mut raw::libssh2_knownhost, - hosts: &'a KnownHosts<'a>, + hosts: &'kh KnownHosts<'kh>, } /// Structure representing a known host as part of a `KnownHosts` structure. -pub struct Host<'a> { +pub struct Host<'kh> { raw: *mut raw::libssh2_knownhost, marker1: marker::NoSync, marker2: marker::NoSend, - marker3: marker::ContravariantLifetime<'a>, - marker4: marker::NoCopy, + marker3: marker::ContravariantLifetime<'kh>, } -impl<'a> KnownHosts<'a> { +impl<'sess> KnownHosts<'sess> { /// Wraps a raw pointer in a new KnownHosts structure tied to the lifetime /// of the given session. /// @@ -227,8 +226,8 @@ impl<'a> Drop for KnownHosts<'a> { } } -impl<'a> Iterator<Result<Host<'a>, Error>> for Hosts<'a> { - fn next(&mut self) -> Option<Result<Host<'a>, Error>> { +impl<'kh> Iterator<Result<Host<'kh>, Error>> for Hosts<'kh> { + fn next(&mut self) -> Option<Result<Host<'kh>, Error>> { unsafe { let mut next = 0 as *mut _; match raw::libssh2_knownhost_get(self.hosts.raw, @@ -242,19 +241,18 @@ impl<'a> Iterator<Result<Host<'a>, Error>> for Hosts<'a> { } } -impl<'a> Host<'a> { +impl<'kh> Host<'kh> { /// Creates a new host from its raw counterpart. /// /// Unsafe as there are no restrictions on the lifetime of the host returned /// and the validity of `raw` is not known. - pub unsafe fn from_raw<'a>(raw: *mut raw::libssh2_knownhost) - -> Host<'a> { + pub unsafe fn from_raw(raw: *mut raw::libssh2_knownhost) + -> Host<'kh> { Host { raw: raw, marker1: marker::NoSync, marker2: marker::NoSend, marker3: marker::ContravariantLifetime, - marker4: marker::NoCopy, } } |