feat: put len before xs

This commit is contained in:
JakkuSakura
2023-12-19 10:48:49 +09:00
committed by bluss
parent 27401fbc22
commit 1cd7b9d859
2 changed files with 4 additions and 2 deletions
+2 -1
View File
@@ -31,10 +31,11 @@ use serde::{Serialize, Deserialize, Serializer, Deserializer};
/// The string is a contiguous value that you can store directly on the stack
/// if needed.
#[derive(Copy)]
#[repr(C)]
pub struct ArrayString<const CAP: usize> {
// the `len` first elements of the array are initialized
xs: [MaybeUninit<u8>; CAP],
len: LenUint,
xs: [MaybeUninit<u8>; CAP],
}
impl<const CAP: usize> Default for ArrayString<CAP>