I have been working on adding support for the the Signed Certificate Timestamp extension in x509-cert crate. Since some data in this extension is TLS encoded I an using the tls_codec crate. But I'm a bit confused about the structure of some of the types and traits in tls_codec. Specifially:
- What's the difference between
TlsVecU8<T> and TlsByteVecU8. To me it looks like TlsByteVecU8 can be just a type alias: type TlsByteVecU8 = TlsVecU8<u8>. Is this true? If yes, why do we have two entirely separate types?
- What is the difference between
Serialize and SerializeBytes traits (same for Deserialize and DeserializeBytes)? Are Serialize and Deserialize meant to be used only in an std environment (because they use std::io::{Read, Write})? If yes, why can't SerializeBytes and DeserializeBytes work for both std and no_std?
- Why is
DeserializeBytes impl'd for TlsVecU8<T> but SerializeBytes is not?
Answers to these would be greatly appreciated. Especially the last one because currently my types implement Serialize and DeserializeBytes which looks a bit asymmetric to me.
cc @tarcieri @franziskuskiefer
I have been working on adding support for the the Signed Certificate Timestamp extension in x509-cert crate. Since some data in this extension is TLS encoded I an using the
tls_codeccrate. But I'm a bit confused about the structure of some of the types and traits intls_codec. Specifially:TlsVecU8<T>andTlsByteVecU8. To me it looks likeTlsByteVecU8can be just a type alias:type TlsByteVecU8 = TlsVecU8<u8>. Is this true? If yes, why do we have two entirely separate types?SerializeandSerializeBytestraits (same forDeserializeandDeserializeBytes)? AreSerializeandDeserializemeant to be used only in anstdenvironment (because they use std::io::{Read, Write})? If yes, why can'tSerializeBytesandDeserializeByteswork for bothstdandno_std?DeserializeBytesimpl'd forTlsVecU8<T>butSerializeBytesis not?Answers to these would be greatly appreciated. Especially the last one because currently my types implement
SerializeandDeserializeByteswhich looks a bit asymmetric to me.cc @tarcieri @franziskuskiefer