Trait ed::Terminated [−][src]
pub trait Terminated { }
Expand description
A type is Terminated
the length of the value being read can be determined
when decoding.
Since Terminated
is an auto trait, it is automatically present for any
type made of fields which are all Terminated
.
Consider a type like u32
- it is always 4 bytes long. If a slice of length
5 was passed to its decode
method, it would know to stop reading after the
4th byte, which means it is Terminated
.
For an example of something which is NOT terminated, consider Vec<u8>
. Its
encoding and decoding do not use a length prefix or end with a null byte, so
decode
would have no way to know where to stop reading.