Skip to content

Commit

Permalink
Merge pull request #108 from nox/store-clone
Browse files Browse the repository at this point in the history
Implement ToOwned for X509StoreRef and Clone for X509Store
  • Loading branch information
inikulin authored May 11, 2023
2 parents da32be1 + 2ceb992 commit 1c1af4b
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions boring/src/x509/store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,4 +109,21 @@ impl X509StoreRef {
}
}

impl ToOwned for X509StoreRef {
type Owned = X509Store;

fn to_owned(&self) -> X509Store {
unsafe {
ffi::X509_STORE_up_ref(self.as_ptr());
X509Store::from_ptr(self.as_ptr())
}
}
}

impl Clone for X509Store {
fn clone(&self) -> Self {
(**self).to_owned()
}
}

use crate::ffi::X509_STORE_get0_objects;

0 comments on commit 1c1af4b

Please sign in to comment.