Remove len and is_empty from impl_array_newtype macros

An array in Rust has no concept of length, it is a fixed size data type.
Equally an array cannot be "empty", again since it is a fixed size data
type. These are methods/concepts seen in slices and vectors.

Remove the `len` and `is_empty` methods.
This commit is contained in:
Tobin C. Harding 2022-11-17 11:00:03 +11:00
parent 9788b6df88
commit 630fc1fcb6
2 changed files with 0 additions and 20 deletions

View File

@ -19,16 +19,6 @@ macro_rules! impl_array_newtype {
($thing:ident, $ty:ty, $len:expr) => { ($thing:ident, $ty:ty, $len:expr) => {
impl Copy for $thing {} impl Copy for $thing {}
impl $thing {
/// 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.
#[inline]
pub fn is_empty(&self) -> bool { false }
}
impl AsRef<[$ty; $len]> for $thing { impl AsRef<[$ty; $len]> for $thing {
#[inline] #[inline]
/// Gets a reference to the underlying array /// Gets a reference to the underlying array

View File

@ -19,16 +19,6 @@ macro_rules! impl_array_newtype {
($thing:ident, $ty:ty, $len:expr) => { ($thing:ident, $ty:ty, $len:expr) => {
impl Copy for $thing {} impl Copy for $thing {}
impl $thing {
/// 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.
#[inline]
pub fn is_empty(&self) -> bool { false }
}
impl AsRef<[$ty; $len]> for $thing { impl AsRef<[$ty; $len]> for $thing {
#[inline] #[inline]
/// Gets a reference to the underlying array /// Gets a reference to the underlying array