pub fn try_read_bytes(
bitstring: &[u8],
ty: TypeId,
) -> Result<Box<dyn EvaluatedTerm<TLSProtocolTypes>>, Error>
Expand description
To read
an EvaluatedTerm<PT>
out of a bitstring, we cannot simply use Codec::read_bytes
since the type of the value to be initialized is not known, we only have the argument ty
from
which we can downcast and then call read_bytes
on the appropriate type.
try_read_bytes
calls a macro try_read
that does this.
(There is no workaround for the uninitialized value type since we need to make Codec traits
into dyn objects, hence it cannot have Sized
as a supertrait.)