Crates.io | cdr-encoding-size |
lib.rs | cdr-encoding-size |
version | 0.5.1 |
source | src |
created_at | 2021-11-04 11:40:26.168193 |
updated_at | 2024-04-24 07:46:50.899793 |
description | Helper crate for RustDDS: Trait to compute the maximum CDR-serialized size of data |
homepage | |
repository | https://github.com/jhelovuo/cdr-encoding |
max_upload_size | |
id | 476602 |
size | 5,944 |
This crate specifies the CdrEncodingSize
trait. It is a helper to the RustDDS library.
The trait is in a separate crate, because it has a derive-macro, and (the Rust Programming Language, Section "19.5 Macros")[https://doc.rust-lang.org/book/ch19-06-macros.html] advises that "At the time of this writing, procedural macros need to be in their own crate. Eventually, this restriction might be lifted."
The RTPS specification version 2.5 Section "9.6.4.8 KeyHash (PID_KEY_HASH)" defines an algorithm for computing a 16-byte hash of a DDS Key of a data sample.
The algorithm summary:
This trait is an automated mechanism for deciding if the 16-byte limit is exceeded, i.e. if MD5 hashing should be used or not.
TODO
struct
s, but not enum
types. It will fail if a Key type is, or contains, an enum
.