Skip to content

Commit

Permalink
Rearrange Ldap/LdapConn methods
Browse files Browse the repository at this point in the history
Place the very niche is_closed() at the end so the more important
ones come first.
  • Loading branch information
inejge committed Dec 20, 2022
1 parent dc8add9 commit fbec42f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
13 changes: 7 additions & 6 deletions src/ldap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -192,11 +192,6 @@ impl Ldap {
Ok((result, exop, sasl_creds))
}

/// Check whether the underlying connection has been closed.
pub fn is_closed(&mut self) -> bool {
self.tx.is_closed()
}

/// Use the provided `SearchOptions` with the next Search operation, which can
/// be invoked directly on the result of this method. If this method is used in
/// combination with a non-Search operation, the provided options will be silently
Expand Down Expand Up @@ -722,9 +717,15 @@ impl Ldap {
.map(|_| ())?)
}

/// Check whether the underlying connection has been closed.
pub fn is_closed(&mut self) -> bool {
self.tx.is_closed()
}

/// Return the TLS peer certificate in DER format.
///
/// The method returns Ok(None) if no certificate was found or
/// the connection does not use TLS.
/// the connection does not use or support TLS.
pub async fn get_peer_certificate(&mut self) -> Result<Option<Vec<u8>>> {
#[cfg(any(feature = "tls-native", feature = "tls-rustls"))]
{
Expand Down
10 changes: 5 additions & 5 deletions src/sync.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,6 @@ impl LdapConn {
self
}

/// See [`Ldap::is_closed()`](struct.Ldap.html#method.is_closed).
pub fn is_closed(&mut self) -> bool {
self.ldap.tx.is_closed()
}

/// See [`Ldap::simple_bind()`](struct.Ldap.html#method.simple_bind).
pub fn simple_bind(&mut self, bind_dn: &str, bind_pw: &str) -> Result<LdapResult> {
let rt = &mut self.rt;
Expand Down Expand Up @@ -258,6 +253,11 @@ impl LdapConn {
rt.block_on(async move { ldap.abandon(msgid).await })
}

/// See [`Ldap::is_closed()`](struct.Ldap.html#method.is_closed).
pub fn is_closed(&mut self) -> bool {
self.ldap.tx.is_closed()
}

/// See [`Ldap::get_peer_certificate()`](struct.Ldap.html#method.get_peer_certificate).
pub fn get_peer_certificate(&mut self) -> Result<Option<Vec<u8>>> {
let rt = &mut self.rt;
Expand Down

0 comments on commit fbec42f

Please sign in to comment.