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, fake::Dummy, serde::Serialize, serde::Deserialize)]
7pub struct Slot {
8    pub index: SlotIndex,
9    pub value: SlotValue,
10}
11
12impl Slot {
13    /// Creates a new slot with the given index and value.
14    pub fn new(index: SlotIndex, value: SlotValue) -> Self {
15        Self { index, value }
16    }
17
18    /// Creates a new slot with the given index and default zero value.
19    pub fn new_empty(index: SlotIndex) -> Self {
20        Self {
21            index,
22            value: SlotValue::default(),
23        }
24    }
25}