Improve docs on impl_array_newtype

Improve the rustdocs on the `impl_array_newtype` macro by adding full
stops and re-writing the outer comment.
This commit is contained in:
Tobin C. Harding 2022-11-03 14:36:17 +11:00
parent 91ac518d17
commit 1c17d0f215
1 changed files with 5 additions and 5 deletions

View File

@ -13,32 +13,32 @@
// If not, see <http://creativecommons.org/publicdomain/zero/1.0/>.
//
// This is a macro that routinely comes in handy
/// Implement methods and traits for types that contain an inner array.
#[macro_export]
macro_rules! impl_array_newtype {
($thing:ident, $ty:ty, $len:expr) => {
impl Copy for $thing {}
impl $thing {
/// Converts the object to a raw pointer for FFI interfacing
/// Converts the object to a raw pointer for FFI interfacing.
#[inline]
pub fn as_ptr(&self) -> *const $ty {
let &$thing(ref dat) = self;
dat.as_ptr()
}
/// Converts the object to a mutable raw pointer for FFI interfacing
/// Converts the object to a mutable raw pointer for FFI interfacing.
#[inline]
pub fn as_mut_ptr(&mut self) -> *mut $ty {
let &mut $thing(ref mut dat) = self;
dat.as_mut_ptr()
}
/// Returns the length of the object as an array
/// Returns the length of the object as an array.
#[inline]
pub fn len(&self) -> usize { $len }
/// Returns whether the object as an array is empty
/// Returns whether the object as an array is empty.
#[inline]
pub fn is_empty(&self) -> bool { false }
}