diff --git a/generate_arrayvec_copy b/generate_arrayvec_copy index 7b8e2a9..bebe5a3 100755 --- a/generate_arrayvec_copy +++ b/generate_arrayvec_copy @@ -12,6 +12,7 @@ set -o pipefail sed \ -e "s/\\/ArrayVecCopy/g" \ + -e "s/\\/arrayvec::copy::ArrayVecCopy/g" \ -e "s/impl<\\('[A-Za-z_]*, \\)\\?T:/impl<\\1T: Copy +/g" \ -e "s/impl<\\('[A-Za-z_]*, \\)\\?T,/impl<\\1T: Copy,/g" \ -e "s/struct \\([A-Za-z_]*\\)<\\('[A-Za-z_]*, \\)\\?T:/struct \\1<\\2T: Copy +/g" \ @@ -21,6 +22,4 @@ sed \ -e "s/const fn/fn/" \ -e "s/\\/\\/ DIRECTIVE ArrayVecCopy \\+//" \ src/arrayvec.rs \ - > src/arrayvec_copy_generated.rs - -mv -v -f src/arrayvec_copy_generated.rs src/arrayvec_copy.rs + > src/arrayvec_copy.rs diff --git a/src/arrayvec_copy.rs b/src/arrayvec_copy.rs index 0d12c58..c56c3c0 100644 --- a/src/arrayvec_copy.rs +++ b/src/arrayvec_copy.rs @@ -84,7 +84,7 @@ impl ArrayVecCopy { /// The maximum capacity is given by the generic parameter `CAP`. /// /// ``` - /// use arrayvec::ArrayVecCopy; + /// use arrayvec::copy::ArrayVecCopy; /// /// let mut array = ArrayVecCopy::<_, 16>::new(); /// array.push(1); @@ -107,7 +107,7 @@ impl ArrayVecCopy { /// The maximum capacity is given by the generic parameter `CAP`. /// /// ``` - /// use arrayvec::ArrayVecCopy; + /// use arrayvec::copy::ArrayVecCopy; /// /// static ARRAY: ArrayVecCopy = ArrayVecCopy::new_const(); /// ``` @@ -119,7 +119,7 @@ impl ArrayVecCopy { /// Return the number of elements in the `ArrayVecCopy`. /// /// ``` - /// use arrayvec::ArrayVecCopy; + /// use arrayvec::copy::ArrayVecCopy; /// /// let mut array = ArrayVecCopy::from([1, 2, 3]); /// array.pop(); @@ -131,7 +131,7 @@ impl ArrayVecCopy { /// Returns whether the `ArrayVecCopy` is empty. /// /// ``` - /// use arrayvec::ArrayVecCopy; + /// use arrayvec::copy::ArrayVecCopy; /// /// let mut array = ArrayVecCopy::from([1]); /// array.pop(); @@ -143,7 +143,7 @@ impl ArrayVecCopy { /// Return the capacity of the `ArrayVecCopy`. /// /// ``` - /// use arrayvec::ArrayVecCopy; + /// use arrayvec::copy::ArrayVecCopy; /// /// let array = ArrayVecCopy::from([1, 2, 3]); /// assert_eq!(array.capacity(), 3); @@ -154,7 +154,7 @@ impl ArrayVecCopy { /// Return true if the `ArrayVecCopy` is completely filled to its capacity, false otherwise. /// /// ``` - /// use arrayvec::ArrayVecCopy; + /// use arrayvec::copy::ArrayVecCopy; /// /// let mut array = ArrayVecCopy::<_, 1>::new(); /// assert!(!array.is_full()); @@ -166,7 +166,7 @@ impl ArrayVecCopy { /// Returns the capacity left in the `ArrayVecCopy`. /// /// ``` - /// use arrayvec::ArrayVecCopy; + /// use arrayvec::copy::ArrayVecCopy; /// /// let mut array = ArrayVecCopy::from([1, 2, 3]); /// array.pop(); @@ -181,7 +181,7 @@ impl ArrayVecCopy { /// ***Panics*** if the vector is already full. /// /// ``` - /// use arrayvec::ArrayVecCopy; + /// use arrayvec::copy::ArrayVecCopy; /// /// let mut array = ArrayVecCopy::<_, 2>::new(); /// @@ -201,7 +201,7 @@ impl ArrayVecCopy { /// is already full. /// /// ``` - /// use arrayvec::ArrayVecCopy; + /// use arrayvec::copy::ArrayVecCopy; /// /// let mut array = ArrayVecCopy::<_, 2>::new(); /// @@ -229,7 +229,7 @@ impl ArrayVecCopy { /// This method uses *debug assertions* to check that the arrayvec is not full. /// /// ``` - /// use arrayvec::ArrayVecCopy; + /// use arrayvec::copy::ArrayVecCopy; /// /// let mut array = ArrayVecCopy::<_, 2>::new(); /// @@ -253,7 +253,7 @@ impl ArrayVecCopy { /// effect. /// /// ``` - /// use arrayvec::ArrayVecCopy; + /// use arrayvec::copy::ArrayVecCopy; /// /// let mut array = ArrayVecCopy::from([1, 2, 3, 4, 5]); /// array.truncate(3); @@ -287,7 +287,7 @@ impl ArrayVecCopy { /// `try_insert` for fallible version. /// /// ``` - /// use arrayvec::ArrayVecCopy; + /// use arrayvec::copy::ArrayVecCopy; /// /// let mut array = ArrayVecCopy::<_, 2>::new(); /// @@ -311,7 +311,7 @@ impl ArrayVecCopy { /// ***Panics*** `index` is out of bounds. /// /// ``` - /// use arrayvec::ArrayVecCopy; + /// use arrayvec::copy::ArrayVecCopy; /// /// let mut array = ArrayVecCopy::<_, 2>::new(); /// @@ -352,7 +352,7 @@ impl ArrayVecCopy { /// Return `Some(` *element* `)` if the vector is non-empty, else `None`. /// /// ``` - /// use arrayvec::ArrayVecCopy; + /// use arrayvec::copy::ArrayVecCopy; /// /// let mut array = ArrayVecCopy::<_, 2>::new(); /// @@ -374,7 +374,7 @@ impl ArrayVecCopy { /// ***Panics*** if the `index` is out of bounds. /// /// ``` - /// use arrayvec::ArrayVecCopy; + /// use arrayvec::copy::ArrayVecCopy; /// /// let mut array = ArrayVecCopy::from([1, 2, 3]); /// @@ -399,7 +399,7 @@ impl ArrayVecCopy { /// Return `Some(` *element* `)` if the index is in bounds, else `None`. /// /// ``` - /// use arrayvec::ArrayVecCopy; + /// use arrayvec::copy::ArrayVecCopy; /// /// let mut array = ArrayVecCopy::from([1, 2, 3]); /// @@ -424,7 +424,7 @@ impl ArrayVecCopy { /// ***Panics*** if the `index` is out of bounds. /// /// ``` - /// use arrayvec::ArrayVecCopy; + /// use arrayvec::copy::ArrayVecCopy; /// /// let mut array = ArrayVecCopy::from([1, 2, 3]); /// @@ -445,7 +445,7 @@ impl ArrayVecCopy { /// is no element at `index`. Otherwise, return the element inside `Some`. /// /// ``` - /// use arrayvec::ArrayVecCopy; + /// use arrayvec::copy::ArrayVecCopy; /// /// let mut array = ArrayVecCopy::from([1, 2, 3]); /// @@ -470,7 +470,7 @@ impl ArrayVecCopy { /// elements. /// /// ``` - /// use arrayvec::ArrayVecCopy; + /// use arrayvec::copy::ArrayVecCopy; /// /// let mut array = ArrayVecCopy::from([1, 2, 3, 4]); /// array.retain(|x| *x & 1 != 0 ); @@ -562,7 +562,7 @@ impl ArrayVecCopy { /// # Examples /// /// ``` - /// use arrayvec::ArrayVecCopy; + /// use arrayvec::copy::ArrayVecCopy; /// /// // Allocate vector big enough for 10 elements. /// let mut v: ArrayVecCopy = ArrayVecCopy::new(); @@ -601,7 +601,7 @@ impl ArrayVecCopy { /// Copy all elements from the slice and append to the `ArrayVecCopy`. /// /// ``` - /// use arrayvec::ArrayVecCopy; + /// use arrayvec::copy::ArrayVecCopy; /// /// let mut vec: ArrayVecCopy = ArrayVecCopy::new(); /// vec.push(1); @@ -645,7 +645,7 @@ impl ArrayVecCopy { /// the end point is greater than the length of the vector. /// /// ``` - /// use arrayvec::ArrayVecCopy; + /// use arrayvec::copy::ArrayVecCopy; /// /// let mut v1 = ArrayVecCopy::from([1, 2, 3]); /// let v2: ArrayVecCopy<_, 3> = v1.drain(0..2).collect(); @@ -726,7 +726,7 @@ impl ArrayVecCopy { /// Returns the ArrayVecCopy, replacing the original with a new empty ArrayVecCopy. /// /// ``` - /// use arrayvec::ArrayVecCopy; + /// use arrayvec::copy::ArrayVecCopy; /// /// let mut v = ArrayVecCopy::from([0, 1, 2, 3]); /// assert_eq!([0, 1, 2, 3], v.take().into_inner().unwrap()); @@ -796,7 +796,7 @@ impl DerefMut for ArrayVecCopy { /// Create an `ArrayVecCopy` from an array. /// /// ``` -/// use arrayvec::ArrayVecCopy; +/// use arrayvec::copy::ArrayVecCopy; /// /// let mut array = ArrayVecCopy::from([1, 2, 3]); /// assert_eq!(array.len(), 3); @@ -821,7 +821,7 @@ impl From<[T; CAP]> for ArrayVecCopy { /// fit. /// /// ``` -/// use arrayvec::ArrayVecCopy; +/// use arrayvec::copy::ArrayVecCopy; /// use std::convert::TryInto as _; /// /// let array: ArrayVecCopy<_, 4> = (&[1, 2, 3] as &[_]).try_into().unwrap(); @@ -848,7 +848,7 @@ impl std::convert::TryFrom<&[T]> for ArrayVecCopy IntoIterator for &'a ArrayVecCopy IntoIterator for &'a mut ArrayVecCopy IntoIterator for ArrayVecCopy { /// Cannot ensure that previous moves of the `ArrayVecCopy` did not leave values on the stack. /// /// ``` -/// use arrayvec::ArrayVecCopy; +/// use arrayvec::copy::ArrayVecCopy; /// use zeroize::Zeroize; /// let mut array = ArrayVecCopy::from([1, 2, 3]); /// array.zeroize(); diff --git a/src/lib.rs b/src/lib.rs index 8e8c1a1..8ea1436 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -66,10 +66,9 @@ mod errors; mod utils; pub mod copy { - pub use crate::arrayvec_copy::{Drain, IntoIter}; + pub use crate::arrayvec_copy::{ArrayVecCopy, Drain, IntoIter}; } -pub use crate::arrayvec_copy::ArrayVecCopy; pub use crate::array_string::ArrayString; pub use crate::errors::CapacityError;