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.
```
This commit is contained in:
Tobin Harding 2021-11-18 10:58:38 +11:00
parent c3be285c1d
commit d25431c1da
No known key found for this signature in database
GPG Key ID: 40BF9E4C269D6607
1 changed files with 8 additions and 8 deletions

View File

@ -54,7 +54,7 @@ impl_from_array_len!(SharedSecret, 256, (16 20 28 32 48 64 96 128 256));
impl SharedSecret { impl SharedSecret {
/// Create an empty SharedSecret /// Creates an empty `SharedSecret`.
pub(crate) fn empty() -> SharedSecret { pub(crate) fn empty() -> SharedSecret {
SharedSecret { SharedSecret {
data: [0u8; 256], 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 { pub(crate) fn get_data_mut_ptr(&mut self) -> *mut u8 {
self.data.as_mut_ptr() 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 { pub fn capacity(&self) -> usize {
self.data.len() self.data.len()
} }
/// Get the len of the used data. /// Gets the len of the used data.
pub fn len(&self) -> usize { pub fn len(&self) -> usize {
self.len 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 { pub fn is_empty(&self) -> bool {
self.data.is_empty() 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) { pub(crate) fn set_len(&mut self, len: usize) {
debug_assert!(len <= self.data.len()); debug_assert!(len <= self.data.len());
self.len = 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 { 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] #[inline]
pub fn new(point: &PublicKey, scalar: &SecretKey) -> SharedSecret { pub fn new(point: &PublicKey, scalar: &SecretKey) -> SharedSecret {
let mut ss = SharedSecret::empty(); 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` /// 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. /// `SharedSecret` can be easily created via the `From` impl from arrays.
/// # Examples /// # Examples