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

Commit 4b90c6f

Browse files
committed
feat(rtc_types): add mod byte_formats
1 parent cc2dc35 commit 4b90c6f

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

rtc_types/src/byte_formats/mod.rs

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
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]`)

rtc_types/src/lib.rs

+2
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ pub use exec_token::*;
2525
mod ecall_result;
2626
pub use ecall_result::*;
2727

28+
pub mod byte_formats;
29+
2830
#[repr(C)]
2931
#[derive(Clone, Debug)]
3032
pub struct EncryptedMessage {

0 commit comments

Comments
 (0)