FEAT: Switch to using MaybeUninit for everything

Use std::mem::MaybeUninit and stop using nodrop as a fallback.
This means we require Rust 1.36
This commit is contained in:
bluss
2019-09-01 12:18:17 +02:00
parent ba94336265
commit 8093e8d886
10 changed files with 22 additions and 269 deletions
+4 -4
View File
@@ -17,7 +17,7 @@ use char::encode_utf8;
#[cfg(feature="serde-1")]
use serde::{Serialize, Deserialize, Serializer, Deserializer};
use super::MaybeUninitCopy;
use super::MaybeUninit as MaybeUninitCopy;
/// A string with a fixed capacity.
///
@@ -98,10 +98,10 @@ impl<A> ArrayString<A>
/// ```
pub fn from_byte_string(b: &A) -> Result<Self, Utf8Error> {
let len = str::from_utf8(b.as_slice())?.len();
debug_assert_eq!(len, A::capacity());
debug_assert_eq!(len, A::CAPACITY);
Ok(ArrayString {
xs: MaybeUninitCopy::from(*b),
len: Index::from(A::capacity()),
len: Index::from(A::CAPACITY),
})
}
@@ -114,7 +114,7 @@ impl<A> ArrayString<A>
/// assert_eq!(string.capacity(), 3);
/// ```
#[inline]
pub fn capacity(&self) -> usize { A::capacity() }
pub fn capacity(&self) -> usize { A::CAPACITY }
/// Return if the `ArrayString` is completely filled.
///