context: Improve rustdocs
Improve the rustdocs in the `schnorr` module by doing: - Use third person tense - Add full stops - Use links and code ticks
This commit is contained in:
parent
e945751d85
commit
ecdad39ef4
|
@ -71,10 +71,10 @@ pub unsafe trait Context: private::Sealed {
|
|||
unsafe fn deallocate(ptr: *mut u8, size: usize);
|
||||
}
|
||||
|
||||
/// Marker trait for indicating that an instance of `Secp256k1` can be used for signing.
|
||||
/// Marker trait for indicating that an instance of [`Secp256k1`] can be used for signing.
|
||||
pub trait Signing: Context {}
|
||||
|
||||
/// Marker trait for indicating that an instance of `Secp256k1` can be used for verification.
|
||||
/// Marker trait for indicating that an instance of [`Secp256k1`] can be used for verification.
|
||||
pub trait Verification: Context {}
|
||||
|
||||
/// Represents the set of capabilities needed for signing (preallocated memory).
|
||||
|
@ -239,8 +239,8 @@ mod alloc_only {
|
|||
impl Secp256k1<VerifyOnly> {
|
||||
/// Creates a new Secp256k1 context that can only be used for verification.
|
||||
///
|
||||
/// If `rand-std` feature is enabled, context will have been randomized using `thread_rng`.
|
||||
/// If `rand-std` feature is not enabled please consider randomizing the context (see docs
|
||||
/// * If `rand-std` feature is enabled, context will have been randomized using `thread_rng`.
|
||||
/// * If `rand-std` feature is not enabled please consider randomizing the context (see docs
|
||||
/// for `Secp256k1::gen_new()`).
|
||||
pub fn verification_only() -> Secp256k1<VerifyOnly> { Secp256k1::gen_new() }
|
||||
}
|
||||
|
@ -321,7 +321,7 @@ impl<'buf, C: Context + 'buf> Secp256k1<C> {
|
|||
}
|
||||
|
||||
impl<'buf> Secp256k1<AllPreallocated<'buf>> {
|
||||
/// Creates a new Secp256k1 context with all capabilities
|
||||
/// Creates a new Secp256k1 context with all capabilities.
|
||||
pub fn preallocated_new(
|
||||
buf: &'buf mut [AlignedType],
|
||||
) -> Result<Secp256k1<AllPreallocated<'buf>>, Error> {
|
||||
|
@ -330,7 +330,7 @@ impl<'buf> Secp256k1<AllPreallocated<'buf>> {
|
|||
/// Uses the ffi `secp256k1_context_preallocated_size` to check the memory size needed for a context.
|
||||
pub fn preallocate_size() -> usize { Self::preallocate_size_gen() }
|
||||
|
||||
/// Create a context from a raw context.
|
||||
/// Creates a context from a raw context.
|
||||
///
|
||||
/// # Safety
|
||||
/// This is highly unsafe, due to the number of conditions that aren't checked.
|
||||
|
@ -364,9 +364,10 @@ impl<'buf> Secp256k1<SignOnlyPreallocated<'buf>> {
|
|||
#[inline]
|
||||
pub fn preallocate_signing_size() -> usize { Self::preallocate_size_gen() }
|
||||
|
||||
/// Create a context from a raw context.
|
||||
/// Creates a context from a raw context.
|
||||
///
|
||||
/// # Safety
|
||||
///
|
||||
/// This is highly unsafe, due to the number of conditions that aren't checked.
|
||||
/// * `raw_ctx` needs to be a valid Secp256k1 context pointer.
|
||||
/// that was generated by *exactly* the same code/version of the libsecp256k1 used here.
|
||||
|
@ -398,9 +399,10 @@ impl<'buf> Secp256k1<VerifyOnlyPreallocated<'buf>> {
|
|||
#[inline]
|
||||
pub fn preallocate_verification_size() -> usize { Self::preallocate_size_gen() }
|
||||
|
||||
/// Create a context from a raw context.
|
||||
/// Creates a context from a raw context.
|
||||
///
|
||||
/// # Safety
|
||||
///
|
||||
/// This is highly unsafe, due to the number of conditions that aren't checked.
|
||||
/// * `raw_ctx` needs to be a valid Secp256k1 context pointer.
|
||||
/// that was generated by *exactly* the same code/version of the libsecp256k1 used here.
|
||||
|
|
Loading…
Reference in New Issue