Skip to content

Add as_mut_ptr to PublicKey #105

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 1, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion src/key.rs
Original file line number Diff line number Diff line change
Expand Up @@ -213,12 +213,18 @@ impl<'de> ::serde::Deserialize<'de> for SecretKey {
}

impl PublicKey {
/// Obtains a raw pointer suitable for use with FFI functions
/// Obtains a raw const pointer suitable for use with FFI functions
#[inline]
pub fn as_ptr(&self) -> *const ffi::PublicKey {
&self.0 as *const _
}

/// Obtains a raw mutable pointer suitable for use with FFI functions
#[inline]
pub fn as_mut_ptr(&mut self) -> *mut ffi::PublicKey {
&mut self.0 as *mut _
}

/// Creates a new public key from a secret key.
#[inline]
pub fn from_secret_key<C: Signing>(secp: &Secp256k1<C>,
Expand Down