A container for storing an 'a
as a bin-io buffer. The advantages of storing a
value as an 'a t
rather than an 'a
are:
'a t
is faster (it's just a blit) and it has the same bin-io
representation as 'a
.However, every time you need to access 'a
itself you need to call value
, which
requires deserializing.
'a t
is safe in the sense that you cannot construct an 'a t
that doesn't store a
valid 'a
. When deserializing an 'a
, this requires actually constructing 'a
. If
you'd like access to the 'a
that's constructed during deserialization, see the
bin_reader_t_with_value
below.
Deserializing requires actually constructing an 'a
, so this reader gives you
access to that 'a
, rather than just throwing it away. This is useful because you
often might want to do something like indexing 'a t
by inspecting 'a
at the time
that you read it.