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:
parent
9788b6df88
commit
630fc1fcb6
|
@ -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
|
||||||
|
|
|
@ -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
|
||||||
|
|
Loading…
Reference in New Issue