forked from sfackler/rust-openssl
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
123 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,3 +2,4 @@ target/ | |
Cargo.lock | ||
.idea/ | ||
*.iml | ||
.vscode/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters