From 91c43e73205d606778da9bb59e9c4665a55ab073 Mon Sep 17 00:00:00 2001 From: Jonas Nick Date: Tue, 16 Apr 2019 18:48:24 +0000 Subject: [PATCH] Add as_mut_ptr to PublicKey --- src/key.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/key.rs b/src/key.rs index 2d90c2e84..e92290b0a 100644 --- a/src/key.rs +++ b/src/key.rs @@ -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(secp: &Secp256k1,