Skip to content

Commit ecdad39

Browse files
committed
context: Improve rustdocs
Improve the rustdocs in the `schnorr` module by doing: - Use third person tense - Add full stops - Use links and code ticks
1 parent e945751 commit ecdad39

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

src/context.rs

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,10 @@ pub unsafe trait Context: private::Sealed {
7171
unsafe fn deallocate(ptr: *mut u8, size: usize);
7272
}
7373

74-
/// Marker trait for indicating that an instance of `Secp256k1` can be used for signing.
74+
/// Marker trait for indicating that an instance of [`Secp256k1`] can be used for signing.
7575
pub trait Signing: Context {}
7676

77-
/// Marker trait for indicating that an instance of `Secp256k1` can be used for verification.
77+
/// Marker trait for indicating that an instance of [`Secp256k1`] can be used for verification.
7878
pub trait Verification: Context {}
7979

8080
/// Represents the set of capabilities needed for signing (preallocated memory).
@@ -239,8 +239,8 @@ mod alloc_only {
239239
impl Secp256k1<VerifyOnly> {
240240
/// Creates a new Secp256k1 context that can only be used for verification.
241241
///
242-
/// If `rand-std` feature is enabled, context will have been randomized using `thread_rng`.
243-
/// If `rand-std` feature is not enabled please consider randomizing the context (see docs
242+
/// * If `rand-std` feature is enabled, context will have been randomized using `thread_rng`.
243+
/// * If `rand-std` feature is not enabled please consider randomizing the context (see docs
244244
/// for `Secp256k1::gen_new()`).
245245
pub fn verification_only() -> Secp256k1<VerifyOnly> { Secp256k1::gen_new() }
246246
}
@@ -299,7 +299,7 @@ unsafe impl<'buf> Context for AllPreallocated<'buf> {
299299
}
300300

301301
impl<'buf, C: Context + 'buf> Secp256k1<C> {
302-
/// Lets you create a context with a preallocated buffer in a generic manner(sign/verify/all).
302+
/// Lets you create a context with a preallocated buffer in a generic manner (sign/verify/all).
303303
pub fn preallocated_gen_new(buf: &'buf mut [AlignedType]) -> Result<Secp256k1<C>, Error> {
304304
#[cfg(target_arch = "wasm32")]
305305
ffi::types::sanity_checks_for_wasm();
@@ -321,7 +321,7 @@ impl<'buf, C: Context + 'buf> Secp256k1<C> {
321321
}
322322

323323
impl<'buf> Secp256k1<AllPreallocated<'buf>> {
324-
/// Creates a new Secp256k1 context with all capabilities
324+
/// Creates a new Secp256k1 context with all capabilities.
325325
pub fn preallocated_new(
326326
buf: &'buf mut [AlignedType],
327327
) -> Result<Secp256k1<AllPreallocated<'buf>>, Error> {
@@ -330,7 +330,7 @@ impl<'buf> Secp256k1<AllPreallocated<'buf>> {
330330
/// Uses the ffi `secp256k1_context_preallocated_size` to check the memory size needed for a context.
331331
pub fn preallocate_size() -> usize { Self::preallocate_size_gen() }
332332

333-
/// Create a context from a raw context.
333+
/// Creates a context from a raw context.
334334
///
335335
/// # Safety
336336
/// This is highly unsafe, due to the number of conditions that aren't checked.
@@ -364,9 +364,10 @@ impl<'buf> Secp256k1<SignOnlyPreallocated<'buf>> {
364364
#[inline]
365365
pub fn preallocate_signing_size() -> usize { Self::preallocate_size_gen() }
366366

367-
/// Create a context from a raw context.
367+
/// Creates a context from a raw context.
368368
///
369369
/// # Safety
370+
///
370371
/// This is highly unsafe, due to the number of conditions that aren't checked.
371372
/// * `raw_ctx` needs to be a valid Secp256k1 context pointer.
372373
/// that was generated by *exactly* the same code/version of the libsecp256k1 used here.
@@ -398,9 +399,10 @@ impl<'buf> Secp256k1<VerifyOnlyPreallocated<'buf>> {
398399
#[inline]
399400
pub fn preallocate_verification_size() -> usize { Self::preallocate_size_gen() }
400401

401-
/// Create a context from a raw context.
402+
/// Creates a context from a raw context.
402403
///
403404
/// # Safety
405+
///
404406
/// This is highly unsafe, due to the number of conditions that aren't checked.
405407
/// * `raw_ctx` needs to be a valid Secp256k1 context pointer.
406408
/// that was generated by *exactly* the same code/version of the libsecp256k1 used here.

0 commit comments

Comments
 (0)