Skip to content
This repository was archived by the owner on May 9, 2022. It is now read-only.

Commit 73b91d4

Browse files
authored
Merge pull request #93 from registreerocks/feat-rkyv-binhelpers
feat(rtc_types): add serialization helpers: byte_formats::rkyv_format
2 parents 7b1b0a3 + c7ea482 commit 73b91d4

File tree

9 files changed

+507
-59
lines changed

9 files changed

+507
-59
lines changed

Cargo.lock

Lines changed: 159 additions & 59 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

rtc_auth_enclave/Cargo.lock

Lines changed: 52 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

rtc_data_enclave/Cargo.lock

Lines changed: 52 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

rtc_exec_enclave/Cargo.lock

Lines changed: 52 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

rtc_tenclave/Cargo.lock

Lines changed: 52 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

rtc_types/Cargo.toml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,16 @@ teaclave_sgx = ["thiserror_sgx", "sgx_tstd"]
1717
[dependencies]
1818
sgx_types = { git = "https://github.com/apache/incubator-teaclave-sgx-sdk.git", rev = "b9d1bda", features = ["extra_traits"] }
1919

20+
# no_std libraries
21+
rkyv = { version = "0.6.6", default_features = false, features = ["const_generics", "strict"] }
22+
2023
# default
2124
thiserror = { version = "1.0.24", optional = true}
2225

2326
# teaclave_sgx
2427
thiserror_sgx = { git = "https://github.com/mesalock-linux/thiserror-sgx.git", package = "thiserror", optional = true }
2528
sgx_tstd = { git = "https://github.com/apache/incubator-teaclave-sgx-sdk.git", rev = "b9d1bda", features = ["backtrace"], optional = true }
29+
30+
[dev-dependencies]
31+
proptest = "1.0.0"
32+
proptest-derive = "0.3.0"

rtc_types/src/byte_formats/mod.rs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
//! Helpers for serializing the types in this library to various byte formats.
2+
//!
3+
//! # Naming convention
4+
//!
5+
//! Sub-modules should be named `{name}_format`, for each binary format implemented.
6+
//!
7+
//! Functions in each module use the following naming convention:
8+
//!
9+
//! > `(write|read|view)_(array|slice)`
10+
//!
11+
//! 1. Operation:
12+
//!
13+
//! - `write` to serialize a structure to bytes
14+
//! - `read` to deserialize bytes to a new Rust structure (copying data)
15+
//! - `view` to deserialize bytes to a structured view (sharing data)
16+
//!
17+
//! 2. Type suffix, for the byte representation:
18+
//!
19+
//! - `array` for working with constant-sized arrays (`[u8; ?]`)
20+
//! - `slice` for working with variable-sized slices (`[u8]`)
21+
22+
pub mod rkyv_format;

0 commit comments

Comments
 (0)