@@ -86,7 +86,8 @@ mod std_only {
86
86
}
87
87
88
88
impl < C : Context > Secp256k1 < C > {
89
- fn gen_new ( ) -> Secp256k1 < C > {
89
+ /// Let's you create a context in a generic manner(sign/verify/all)
90
+ pub fn gen_new ( ) -> Secp256k1 < C > {
90
91
let buf = vec ! [ 0u8 ; Self :: preallocate_size_gen( ) ] . into_boxed_slice ( ) ;
91
92
let ptr = Box :: into_raw ( buf) ;
92
93
Secp256k1 {
@@ -148,8 +149,8 @@ unsafe impl<'buf> Context for SignOnlyPreallocated<'buf> {
148
149
const FLAGS : c_uint = ffi:: SECP256K1_START_SIGN ;
149
150
const DESCRIPTION : & ' static str = "signing only" ;
150
151
151
- fn deallocate ( ptr : * mut [ u8 ] ) {
152
- let _ = ptr ;
152
+ fn deallocate ( _ptr : * mut [ u8 ] ) {
153
+ // Allocated by the user
153
154
}
154
155
}
155
156
@@ -158,7 +159,7 @@ unsafe impl<'buf> Context for VerifyOnlyPreallocated<'buf> {
158
159
const DESCRIPTION : & ' static str = "verification only" ;
159
160
160
161
fn deallocate ( ptr : * mut [ u8 ] ) {
161
- let _ = ptr ;
162
+ // Allocated by the user
162
163
}
163
164
}
164
165
@@ -167,12 +168,13 @@ unsafe impl<'buf> Context for AllPreallocated<'buf> {
167
168
const DESCRIPTION : & ' static str = "all capabilities" ;
168
169
169
170
fn deallocate ( ptr : * mut [ u8 ] ) {
170
- let _ = ptr ;
171
+ // Allocated by the user
171
172
}
172
173
}
173
174
174
175
impl < ' buf , C : Context + ' buf > Secp256k1 < C > {
175
- fn preallocated_gen_new ( buf : & ' buf mut [ u8 ] ) -> Result < Secp256k1 < C > , Error > {
176
+ /// Let's you create a context with preallocated buffer in a generic manner(sign/verify/all)
177
+ pub fn preallocated_gen_new ( buf : & ' buf mut [ u8 ] ) -> Result < Secp256k1 < C > , Error > {
176
178
if buf. len ( ) < Self :: preallocate_size_gen ( ) {
177
179
return Err ( Error :: NotEnoughMemory ) ;
178
180
}
0 commit comments