Skip to main content

runmat_test/identity/
run.rs

1use serde::{Deserialize, Serialize};
2
3use super::algorithm;
4
5#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize, Deserialize)]
6#[serde(transparent)]
7pub struct RunId(String);
8
9impl RunId {
10    pub fn derive(program_revision: &str, invocation_identity: &str) -> Self {
11        Self(algorithm::digest(
12            "run",
13            &[program_revision, invocation_identity],
14        ))
15    }
16
17    pub fn as_str(&self) -> &str {
18        &self.0
19    }
20}