pub struct EntityArray {
pub ids: Vec<u64>,
pub xs: Vec<f32>,
pub ys: Vec<f32>,
pub widths: Vec<f32>,
pub heights: Vec<f32>,
pub z_indices: Vec<u16>,
pub styles: Vec<Style>,
pub state_tags: Vec<u8>,
pub content_hashes: Vec<u64>,
pub content_offsets: Vec<u32>,
pub contents: Vec<u8>,
}Expand description
Structure-of-arrays layout — cache-contiguous, SIMD-friendly.
Each entity carries a state_tag for delta compression:
STATIC(0) — unchanged since client’s last ack
MOVED(1) — position/viewport only
CHANGED(2) — content or style changed
REMOVED(3) — no longer present
content_hashes[i] = XXH3-64 of the content blob for dedup.
Clients cache blobs by hash and only fetch new ones on CHANGED entities.
Fields§
§ids: Vec<u64>§xs: Vec<f32>§ys: Vec<f32>§widths: Vec<f32>§heights: Vec<f32>§z_indices: Vec<u16>§styles: Vec<Style>§content_hashes: Vec<u64>§content_offsets: Vec<u32>§contents: Vec<u8>Implementations§
Source§impl EntityArray
impl EntityArray
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
pub fn clear(&mut self)
pub fn shrink_to_fit(&mut self)
pub fn push( &mut self, id: u64, x: f32, y: f32, w: f32, h: f32, z: u16, style: Style, content: &[u8], )
Sourcepub fn diff_since(&self, prev: &EntityArray) -> ChangedEntities
pub fn diff_since(&self, prev: &EntityArray) -> ChangedEntities
Produce delta between self and an older frame. Returns only entities that differ: STATIC entries are omitted entirely.
pub fn content_slice(&self, idx: usize) -> &[u8] ⓘ
Source§impl EntityArray
impl EntityArray
pub fn with_capacity(n: usize) -> Self
Sourcepub fn hydration_json(&self) -> String
pub fn hydration_json(&self) -> String
Build a JSON string for the ECS-to-JS hydration bridge. Output flat array with parentId for reconstructing the DOM tree in QuickJS.
Trait Implementations§
Source§impl Clone for EntityArray
impl Clone for EntityArray
Source§fn clone(&self) -> EntityArray
fn clone(&self) -> EntityArray
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for EntityArray
impl Debug for EntityArray
Source§impl Default for EntityArray
impl Default for EntityArray
Source§impl<'de> Deserialize<'de> for EntityArray
impl<'de> Deserialize<'de> for EntityArray
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for EntityArray
impl RefUnwindSafe for EntityArray
impl Send for EntityArray
impl Sync for EntityArray
impl Unpin for EntityArray
impl UnsafeUnpin for EntityArray
impl UnwindSafe for EntityArray
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more