feat: put len before xs
This commit is contained in:
+2
-1
@@ -31,10 +31,11 @@ use serde::{Serialize, Deserialize, Serializer, Deserializer};
|
|||||||
/// The string is a contiguous value that you can store directly on the stack
|
/// The string is a contiguous value that you can store directly on the stack
|
||||||
/// if needed.
|
/// if needed.
|
||||||
#[derive(Copy)]
|
#[derive(Copy)]
|
||||||
|
#[repr(C)]
|
||||||
pub struct ArrayString<const CAP: usize> {
|
pub struct ArrayString<const CAP: usize> {
|
||||||
// the `len` first elements of the array are initialized
|
// the `len` first elements of the array are initialized
|
||||||
xs: [MaybeUninit<u8>; CAP],
|
|
||||||
len: LenUint,
|
len: LenUint,
|
||||||
|
xs: [MaybeUninit<u8>; CAP],
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<const CAP: usize> Default for ArrayString<CAP>
|
impl<const CAP: usize> Default for ArrayString<CAP>
|
||||||
|
|||||||
+2
-1
@@ -39,10 +39,11 @@ use crate::utils::MakeMaybeUninit;
|
|||||||
///
|
///
|
||||||
/// It offers a simple API but also dereferences to a slice, so that the full slice API is
|
/// It offers a simple API but also dereferences to a slice, so that the full slice API is
|
||||||
/// available. The ArrayVec can be converted into a by value iterator.
|
/// available. The ArrayVec can be converted into a by value iterator.
|
||||||
|
#[repr(C)]
|
||||||
pub struct ArrayVec<T, const CAP: usize> {
|
pub struct ArrayVec<T, const CAP: usize> {
|
||||||
|
len: LenUint,
|
||||||
// the `len` first elements of the array are initialized
|
// the `len` first elements of the array are initialized
|
||||||
xs: [MaybeUninit<T>; CAP],
|
xs: [MaybeUninit<T>; CAP],
|
||||||
len: LenUint,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T, const CAP: usize> Drop for ArrayVec<T, CAP> {
|
impl<T, const CAP: usize> Drop for ArrayVec<T, CAP> {
|
||||||
|
|||||||
Reference in New Issue
Block a user