stratus/eth/primitives/
slot.rs

1use display_json::DebugAsJson;
2
3use crate::eth::primitives::SlotIndex;
4use crate::eth::primitives::SlotValue;
5
6#[derive(DebugAsJson, Clone, Copy, Default, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
7#[cfg_attr(test, derive(fake::Dummy))]
8pub struct Slot {
9    pub index: SlotIndex,
10    pub value: SlotValue,
11}
12
13impl Slot {
14    /// Creates a new slot with the given index and value.
15    pub fn new(index: SlotIndex, value: SlotValue) -> Self {
16        Self { index, value }
17    }
18
19    /// Creates a new slot with the given index and default zero value.
20    pub fn new_empty(index: SlotIndex) -> Self {
21        Self {
22            index,
23            value: SlotValue::default(),
24        }
25    }
26}