objects/object/
action_id.rs1use serde::{Deserialize, Serialize};
5
6use super::ContentHash;
7
8#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
10pub struct ActionId(ContentHash);
11
12impl ActionId {
13 pub fn from_hash(hash: ContentHash) -> Self {
15 Self(hash)
16 }
17
18 pub fn as_hash(&self) -> &ContentHash {
20 &self.0
21 }
22}
23
24impl std::fmt::Display for ActionId {
25 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
26 write!(f, "{}", self.0.short())
27 }
28}