Add serde serialization support for the full clif ir
This commit is contained in:
@@ -5,6 +5,9 @@ use alloc::vec::Vec;
|
||||
use core::marker::PhantomData;
|
||||
use core::mem;
|
||||
|
||||
#[cfg(feature = "enable-serde")]
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
/// A small list of entity references allocated from a pool.
|
||||
///
|
||||
/// An `EntityList<T>` type provides similar functionality to `Vec<T>`, but with some important
|
||||
@@ -59,7 +62,8 @@ use core::mem;
|
||||
///
|
||||
/// The index stored in an `EntityList` points to part 2, the list elements. The value 0 is
|
||||
/// reserved for the empty list which isn't allocated in the vector.
|
||||
#[derive(Clone, Debug)]
|
||||
#[derive(Clone, Debug, PartialEq)]
|
||||
#[cfg_attr(feature = "enable-serde", derive(Serialize, Deserialize))]
|
||||
pub struct EntityList<T: EntityRef + ReservedValue> {
|
||||
index: u32,
|
||||
unused: PhantomData<T>,
|
||||
@@ -77,6 +81,7 @@ impl<T: EntityRef + ReservedValue> Default for EntityList<T> {
|
||||
|
||||
/// A memory pool for storing lists of `T`.
|
||||
#[derive(Clone, Debug)]
|
||||
#[cfg_attr(feature = "enable-serde", derive(Serialize, Deserialize))]
|
||||
pub struct ListPool<T: EntityRef + ReservedValue> {
|
||||
// The main array containing the lists.
|
||||
data: Vec<T>,
|
||||
|
||||
Reference in New Issue
Block a user