Skip to content

Commit

Permalink
Merge pull request #105 from jonasnick/pk_as_mut_ptr
Browse files Browse the repository at this point in the history
Add as_mut_ptr to PublicKey
  • Loading branch information
apoelstra committed May 1, 2019
2 parents bf9b972 + 91c43e7 commit 82565cb
Showing 1 changed file with 7 additions and 1 deletion.
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

0 comments on commit 82565cb

Please sign in to comment.