From d25431c1da9e290518e9e6aaace8c882fd047edb Mon Sep 17 00:00:00 2001 From: Tobin Harding Date: Thu, 18 Nov 2021 10:58:38 +1100 Subject: [PATCH] Use 3rd person tense for function docs As is typical in the Rust ecosystem use the third person tense when documenting functions. E.g., ``` /// Creates a new Foo. ``` As opposed to ``` /// Create a new Foo. ``` --- src/ecdh.rs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/ecdh.rs b/src/ecdh.rs index a96d8de..e0df282 100644 --- a/src/ecdh.rs +++ b/src/ecdh.rs @@ -54,7 +54,7 @@ impl_from_array_len!(SharedSecret, 256, (16 20 28 32 48 64 96 128 256)); impl SharedSecret { - /// Create an empty SharedSecret + /// Creates an empty `SharedSecret`. pub(crate) fn empty() -> SharedSecret { SharedSecret { data: [0u8; 256], @@ -62,27 +62,27 @@ impl SharedSecret { } } - /// Get a pointer to the underlying data with the specified capacity. + /// Gets a pointer to the underlying data with the specified capacity. pub(crate) fn get_data_mut_ptr(&mut self) -> *mut u8 { self.data.as_mut_ptr() } - /// Get the capacity of the underlying data buffer. + /// Gets the capacity of the underlying data buffer. pub fn capacity(&self) -> usize { self.data.len() } - /// Get the len of the used data. + /// Gets the len of the used data. pub fn len(&self) -> usize { self.len } - /// True if the underlying data buffer is empty. + /// Returns true if the underlying data buffer is empty. pub fn is_empty(&self) -> bool { self.data.is_empty() } - /// Set the length of the object. + /// Sets the length of the object. pub(crate) fn set_len(&mut self, len: usize) { debug_assert!(len <= self.data.len()); self.len = len; @@ -116,7 +116,7 @@ unsafe extern "C" fn c_callback(output: *mut c_uchar, x: *const c_uchar, y: *con } impl SharedSecret { - /// Creates a new shared secret from a pubkey and secret key + /// Creates a new shared secret from a pubkey and secret key. #[inline] pub fn new(point: &PublicKey, scalar: &SecretKey) -> SharedSecret { let mut ss = SharedSecret::empty(); @@ -138,7 +138,7 @@ impl SharedSecret { } - /// Creates a new shared secret from a pubkey and secret key with applied custom hash function + /// Creates a new shared secret from a pubkey and secret key with applied custom hash function. /// The custom hash function must be in the form of `fn(x: [u8;32], y: [u8;32]) -> SharedSecret` /// `SharedSecret` can be easily created via the `From` impl from arrays. /// # Examples