diff --git a/src/lib.rs b/src/lib.rs index 82904a2..e1b30be 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -112,7 +112,7 @@ use typenum::{Diff, Sum}; use zeroize::{Zeroize, ZeroizeOnDrop}; /// Type alias for [`Array`] which is const generic around a size `N`, ala `[T; N]`. -pub type ArrayN = Array::Size>; +pub type ArrayN = Array::Size>; /// [`Array`] is a newtype for an inner `[T; N]` array where `N` is determined by a generic /// [`ArraySize`] parameter, which is a marker trait for a numeric value determined by ZSTs that @@ -134,7 +134,7 @@ pub type ArrayN = Array::S /// The [`AsRef`] trait can be used to convert from `&Array` to `&[T; N]` and vice versa: /// /// ``` -/// use hybrid_array::{Array, ArraySize, AssociatedArraySize, ArrayN, consts::U3}; +/// use hybrid_array::{Array, ArraySize, AssocArraySize, ArrayN, consts::U3}; /// /// pub fn get_third_item_hybrid_array(arr_ref: &Array) -> &T { /// &arr_ref[2] @@ -142,7 +142,7 @@ pub type ArrayN = Array::S /// /// pub fn get_third_item_const_generic(arr_ref: &[T; N]) -> &T /// where -/// [T; N]: AssociatedArraySize + AsRef> +/// [T; N]: AssocArraySize + AsRef> /// { /// get_third_item_hybrid_array(arr_ref.as_ref()) /// } @@ -150,9 +150,9 @@ pub type ArrayN = Array::S /// assert_eq!(get_third_item_const_generic(&[1u8, 2, 3, 4]), &3); /// ``` /// -/// Note that the [`AssociatedArraySize`] trait can be used to determine the appropriate +/// Note that the [`AssocArraySize`] trait can be used to determine the appropriate /// [`Array`] size for a given `[T; N]`, and the [`ArrayN`] trait (which internally uses -/// [`AssociatedArraySize`]) can be used to determine the specific [`Array`] type for a given +/// [`AssocArraySize`]) can be used to determine the specific [`Array`] type for a given /// const generic size. #[repr(transparent)] pub struct Array(pub U::ArrayType); diff --git a/src/sizes.rs b/src/sizes.rs index d6e7576..745b56f 100644 --- a/src/sizes.rs +++ b/src/sizes.rs @@ -1,6 +1,6 @@ //! Macros for defining various array sizes, and their associated invocations. -use super::{ArraySize, AssociatedArraySize}; +use super::{ArraySize, AssocArraySize}; macro_rules! impl_array_size { ($($len:expr => $ty:ident),+) => { @@ -9,7 +9,7 @@ macro_rules! impl_array_size { type ArrayType = [T; $len]; } - impl AssociatedArraySize for [T; $len] { + impl AssocArraySize for [T; $len] { type Size = typenum::$ty; } )+ diff --git a/src/traits.rs b/src/traits.rs index f29cf39..d5824a9 100644 --- a/src/traits.rs +++ b/src/traits.rs @@ -22,7 +22,7 @@ pub unsafe trait ArraySize: Unsigned { /// /// This is always defined to be `[T; N]` where `N` is the same as /// [`ArraySize::USIZE`][`typenum::Unsigned::USIZE`]. - type ArrayType: AssociatedArraySize + type ArrayType: AssocArraySize + AsRef<[T]> + AsMut<[T]> + Borrow<[T]> @@ -37,12 +37,12 @@ pub unsafe trait ArraySize: Unsigned { } /// Associates an [`ArraySize`] with a given type. -pub trait AssociatedArraySize: Sized { +pub trait AssocArraySize: Sized { /// Size of an array type, expressed as a [`typenum`]-based [`ArraySize`]. type Size: ArraySize; } -impl AssociatedArraySize for Array +impl AssocArraySize for Array where U: ArraySize, {