MCPcopy Create free account
hub / github.com/RustCrypto/formats / tls_deserialize

Method tls_deserialize

tls_codec/src/quic_vec.rs:79–94  ·  view source on GitHub ↗
(bytes: &mut R)

Source from the content-addressed store, hash-verified

77impl<T: Deserialize> Deserialize for Vec<T> {
78 #[inline(always)]
79 fn tls_deserialize<R: std::io::Read>(bytes: &mut R) -> Result<Self, Error> {
80 let (length, len_len) = read_variable_length(bytes)?;
81 if length == 0 {
82 // An empty vector.
83 return Ok(Vec::new());
84 }
85
86 let mut result = Vec::new();
87 let mut read = len_len;
88 while (read - len_len) < length as usize {
89 let element = T::tls_deserialize(bytes)?;
90 read += element.tls_serialized_len();
91 result.push(element);
92 }
93 Ok(result)
94 }
95}
96
97#[inline(always)]

Callers

nothing calls this directly

Calls 5

read_variable_lengthFunction · 0.85
tls_deserializeFunction · 0.85
pushMethod · 0.80
tls_serialized_lenMethod · 0.45
readMethod · 0.45

Tested by

no test coverage detected