diff --git a/src/array_string.rs b/src/array_string.rs index 90cfc09..7f6e299 100644 --- a/src/array_string.rs +++ b/src/array_string.rs @@ -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 { // the `len` first elements of the array are initialized - xs: [MaybeUninit; CAP], len: LenUint, + xs: [MaybeUninit; CAP], } impl Default for ArrayString diff --git a/src/arrayvec.rs b/src/arrayvec.rs index d51fbf7..6f64ba5 100644 --- a/src/arrayvec.rs +++ b/src/arrayvec.rs @@ -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 /// available. The ArrayVec can be converted into a by value iterator. +#[repr(C)] pub struct ArrayVec { + len: LenUint, // the `len` first elements of the array are initialized xs: [MaybeUninit; CAP], - len: LenUint, } impl Drop for ArrayVec {