aboutsummaryrefslogtreecommitdiff
path: root/openssl/src
diff options
context:
space:
mode:
authorSteven Fackler <[email protected]>2015-05-02 13:59:11 -0700
committerSteven Fackler <[email protected]>2015-05-02 13:59:11 -0700
commit00c17035ecb6fb637481f0aca1943382fe00847e (patch)
tree030adc35f24be4bd7d03635d6667376182aa3564 /openssl/src
parentRelease v0.6.2 (diff)
downloadrust-openssl-00c17035ecb6fb637481f0aca1943382fe00847e.tar.xz
rust-openssl-00c17035ecb6fb637481f0aca1943382fe00847e.zip
Abstract over AsRef<Path>
Diffstat (limited to 'openssl/src')
-rw-r--r--openssl/src/ssl/mod.rs14
1 files changed, 7 insertions, 7 deletions
diff --git a/openssl/src/ssl/mod.rs b/openssl/src/ssl/mod.rs
index ab559b46..b5a138dd 100644
--- a/openssl/src/ssl/mod.rs
+++ b/openssl/src/ssl/mod.rs
@@ -431,8 +431,8 @@ impl SslContext {
#[allow(non_snake_case)]
/// Specifies the file that contains trusted CA certificates.
- pub fn set_CA_file(&mut self, file: &Path) -> Result<(),SslError> {
- let file = CString::new(file.as_os_str().to_str().expect("invalid utf8")).unwrap();
+ pub fn set_CA_file<P: AsRef<Path>>(&mut self, file: P) -> Result<(),SslError> {
+ let file = CString::new(file.as_ref().as_os_str().to_str().expect("invalid utf8")).unwrap();
wrap_ssl_result(
unsafe {
ffi::SSL_CTX_load_verify_locations(self.ctx, file.as_ptr(), ptr::null())
@@ -440,9 +440,9 @@ impl SslContext {
}
/// Specifies the file that contains certificate
- pub fn set_certificate_file(&mut self, file: &Path,
- file_type: X509FileType) -> Result<(),SslError> {
- let file = CString::new(file.as_os_str().to_str().expect("invalid utf8")).unwrap();
+ pub fn set_certificate_file<P: AsRef<Path>>(&mut self, file: P, file_type: X509FileType)
+ -> Result<(),SslError> {
+ let file = CString::new(file.as_ref().as_os_str().to_str().expect("invalid utf8")).unwrap();
wrap_ssl_result(
unsafe {
ffi::SSL_CTX_use_certificate_file(self.ctx, file.as_ptr(), file_type as c_int)
@@ -467,9 +467,9 @@ impl SslContext {
}
/// Specifies the file that contains private key
- pub fn set_private_key_file(&mut self, file: &Path,
+ pub fn set_private_key_file<P: AsRef<Path>>(&mut self, file: P,
file_type: X509FileType) -> Result<(),SslError> {
- let file = CString::new(file.as_os_str().to_str().expect("invalid utf8")).unwrap();
+ let file = CString::new(file.as_ref().as_os_str().to_str().expect("invalid utf8")).unwrap();
wrap_ssl_result(
unsafe {
ffi::SSL_CTX_use_PrivateKey_file(self.ctx, file.as_ptr(), file_type as c_int)