pub trait RawFormat: 'static {
// Required method
fn info() -> &'static RawFormatInfo;
}Expand description
A data format whose encoded values can be held by Raw.
This is implemented by a type of the crate of the format that stands
for the format (for instance deser_json::Json). The format is
described at runtime by a RawFormatInfo.
§Passing on the Input of Values
Raw values of a format that is deserialized from the same format hold the input of the value, and serializers of the format write them as they are. For this the format:
- calls
State::declare_raw_formatwith itsRawFormatIdin the deserializer (before the first event, it returns the description of the format if the top-level value is wanted as raw value) and in the serializer (before the first value). - checks with
Error::is_raw_requestwhether the result of an event requests the next value as raw value and takes the description of the format withState::take_raw_request. - checks that the description has the
RawFormatIdof the format (requests can be for raw values of any format, they are an error then), validates a value that is wanted as raw value and emits its input asRawInput(anAtom::Ext) with that description rather than its events. - writes the
RawInputof its format as it is when serializing (seeRawInput::is_format).
The parser and the serializer only refer to the RawFormatId: the
functions of the format (like replay, which brings in its parser)
are only in programs that use its raw values.
Formats that do not do this still have raw values: the values are encoded with the format then.
Required Methods§
Sourcefn info() -> &'static RawFormatInfo
fn info() -> &'static RawFormatInfo
Returns the description of the format.
This must always return the same static: formats are identified by the address of their description.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".