aboutsummaryrefslogtreecommitdiff
path: root/openssl/src/ex_data.rs
diff options
context:
space:
mode:
authorSteven Fackler <[email protected]>2017-07-15 18:37:20 -0700
committerGitHub <[email protected]>2017-07-15 18:37:20 -0700
commit0408f75b17d57a072561c25a8a660035b61d68c5 (patch)
treea972a946b2e9ef0babd28967a24e03fc0c97573f /openssl/src/ex_data.rs
parentMerge pull request #657 from sfackler/rsa-pkcs1 (diff)
parentFix build (diff)
downloadrust-openssl-0408f75b17d57a072561c25a8a660035b61d68c5.tar.xz
rust-openssl-0408f75b17d57a072561c25a8a660035b61d68c5.zip
Merge pull request #662 from sfackler/verify-cleanup
Don't force overwrite verification mode in SslConnector
Diffstat (limited to 'openssl/src/ex_data.rs')
-rw-r--r--openssl/src/ex_data.rs26
1 files changed, 26 insertions, 0 deletions
diff --git a/openssl/src/ex_data.rs b/openssl/src/ex_data.rs
new file mode 100644
index 00000000..450dd113
--- /dev/null
+++ b/openssl/src/ex_data.rs
@@ -0,0 +1,26 @@
+use libc::c_int;
+use std::marker::PhantomData;
+
+/// A slot in a type's "extra data" structure.
+///
+/// It is parameterized over the type containing the extra data as well as the
+/// type of the data in the slot.
+pub struct Index<T, U>(c_int, PhantomData<(T, U)>);
+
+impl<T, U> Copy for Index<T, U> {}
+
+impl<T, U> Clone for Index<T, U> {
+ fn clone(&self) -> Index<T, U> {
+ *self
+ }
+}
+
+impl<T, U> Index<T, U> {
+ pub unsafe fn from_raw(idx: c_int) -> Index<T, U> {
+ Index(idx, PhantomData)
+ }
+
+ pub fn as_raw(&self) -> c_int {
+ self.0
+ }
+}