Struct regex_automata::util::wire::SerializeError
source · pub struct SerializeError {
what: &'static str,
}
Expand description
An error that occurs when serializing an object from this crate.
Serialization, as used in this crate, universally refers to the process
of transforming a structure (like a DFA) into a custom binary format
represented by &[u8]
. To this end, serialization is generally infallible.
However, it can fail when caller provided buffer sizes are too small. When
that occurs, a serialization error is reported.
A SerializeError
provides no introspection capabilities. Its only
supported operation is conversion to a human readable error message.
This error type implements the std::error::Error
trait only when the
std
feature is enabled. Otherwise, this type is defined in all
configurations.
Fields§
§what: &'static str
The name of the thing that a buffer is too small for.
Currently, the only kind of serialization error is one that is committed by a caller: providing a destination buffer that is too small to fit the serialized object. This makes sense conceptually, since every valid inhabitant of a type should be serializable.
This is somewhat exposed in the public API of this crate. For example,
the to_bytes_{big,little}_endian
APIs return a Vec<u8>
and are
guaranteed to never panic or error. This is only possible because the
implementation guarantees that it will allocate a Vec<u8>
that is
big enough.
In summary, if a new serialization error kind needs to be added, then it will need careful consideration.