topos 0.13.1

An autodiff compiler stack in Rust.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
/// A lightweight handle to a payload's slot in a dense state store.
///
/// Slots are assigned in allocation order and never move: the
/// store-side mirror of `ValueId` used by parameters and inputs.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub(crate) struct SlotId(usize);

impl SlotId {
    /// Creates a slot for `index` in its store.
    pub(crate) fn new(index: usize) -> Self {
        Self(index)
    }

    /// Returns the position of the slot in its store.
    pub(crate) fn index(self) -> usize {
        self.0
    }
}