oasis_contract_sdk_types/
storage.rs1use std::convert::TryFrom;
3
4#[derive(Clone, Copy)]
6#[repr(u32)]
7pub enum StoreKind {
8 Public = 0,
9 Confidential = 1,
10}
11
12impl StoreKind {
13 pub fn prefix(&self) -> &'static [u8] {
15 match self {
16 StoreKind::Public => &[0x00],
17 StoreKind::Confidential => &[0x01],
18 }
19 }
20}
21
22impl TryFrom<u32> for StoreKind {
23 type Error = u32;
24
25 fn try_from(value: u32) -> Result<Self, Self::Error> {
26 match value {
27 0 => Ok(StoreKind::Public),
28 1 => Ok(StoreKind::Confidential),
29 _ => Err(value),
30 }
31 }
32}