1#![cfg_attr(not(feature = "std"), no_std)]
4#![deny(missing_docs)]
5
6extern crate alloc;
7
8use alloc::vec::Vec;
9use core::fmt::Debug;
10
11pub use primitives::{Address, Bytes32, Hash, WorkerPubkey};
12pub use scale;
13
14pub mod bench_app;
15pub mod crypto;
16pub mod metrics;
17pub mod primitives;
18pub mod session;
19pub mod ticket;
20pub mod worker;
21
22mod helpers;
23
24#[derive(Clone, Copy, Debug)]
26#[repr(u8)]
27pub enum ContentType {
28 RpcResponse = 1,
30 EndpointInfo = 2,
32 Metrics = 100,
35 AppData = 101,
37 WorkerAttestation = 102,
39 WorkerDescription = 103,
41 SessionUpdate = 104,
43}
44
45impl ContentType {
46 pub fn wrap_message(&self, message: impl AsRef<[u8]>) -> Vec<u8> {
48 self.wrap_message_iter(message.as_ref().iter().copied())
49 }
50
51 pub fn wrap_message_iter(&self, message: impl IntoIterator<Item = u8>) -> Vec<u8> {
53 [0xff_u8, *self as u8].into_iter().chain(message).collect()
54 }
55}