Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions crates/celox-heap/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ edition.workspace = true
rust-version.workspace = true

[dependencies]
serde = { workspace = true, features = ["rc"] }
fxhash = { workspace = true }

[lints]
Expand Down
4 changes: 2 additions & 2 deletions crates/celox-heap/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ pub const EMPTY_STRING: Handle = 0;
const MIN_COLLECTION_INTERVAL: usize = 1024;

/// What a handle refers to.
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, serde::Serialize, serde::Deserialize)]
pub enum HandleKind {
String,
Object,
Expand Down Expand Up @@ -65,7 +65,7 @@ impl Root {
}

/// Dynamic strings and class objects referenced by [`Handle`].
#[derive(Clone, Debug)]
#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct Heap {
strings: HashMap<Handle, Arc<[u8]>>,
lookup: HashMap<Arc<[u8]>, Handle>,
Expand Down
6 changes: 3 additions & 3 deletions crates/celox-heap/src/objects.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use crate::{Handle, HandleKind, Heap};
/// The handle of `null`, the value of zero-initialized memory.
pub const NULL: Handle = 0;

#[derive(Clone, Debug, PartialEq, Eq)]
#[derive(Clone, Debug, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
pub(crate) struct Object {
class: u32,
random_state: u64,
Expand All @@ -24,7 +24,7 @@ pub(crate) struct Object {
pub(crate) handles: Vec<(u32, HandleKind)>,
}

#[derive(Clone, Debug, Default, PartialEq, Eq)]
#[derive(Clone, Debug, Default, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
struct RandomModes {
overrides: fxhash::FxHashMap<u32, bool>,
/// Non-rand properties temporarily made random by an argument list.
Expand All @@ -47,7 +47,7 @@ impl Object {

/// An error that compiled code made in a heap operation, which the runtime
/// reports once control returns to it.
#[derive(Clone, Debug, PartialEq, Eq)]
#[derive(Clone, Debug, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
pub enum Fault {
/// A property access or method call through `null` or a handle of no
/// live object (IEEE 1800-2023 8.4).
Expand Down
Loading
Loading