#[non_exhaustive]pub struct DecodeOptions {
pub unknown_enum_values: UnknownEnumValues,
pub unknown_fields: UnknownFields,
pub datetime: DateTimeLeniency,
pub numeric_strings: NumericStrings,
pub max_payload_size: usize,
pub max_repairs: usize,
}Expand description
Decoding policy. The strict default is exactly what the specification requires.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.unknown_enum_values: UnknownEnumValuesEnumeration values the schema does not define.
unknown_fields: UnknownFieldsMembers the schema does not define.
datetime: DateTimeLeniencydateTime spellings.
numeric_strings: NumericStringsNumbers sent as strings.
max_payload_size: usizeUpper bound on one payload, in bytes — the fourth element of a CALL, not the
whole frame.
The frame is bounded earlier and elsewhere, at the socket, by
Csms::max_message_size_bytes;
this is the second line, and it is what a handler that decodes a payload of its own
gets for free. OCPP sets no limit of its own, and NotifyReport and
GetCompositeSchedule payloads can be large, so the default is generous.
max_repairs: usizeUpper bound on the number of leniency repairs applied to one payload.
Implementations§
Source§impl DecodeOptions
impl DecodeOptions
Sourcepub const fn pedantic() -> Self
pub const fn pedantic() -> Self
Everything the schemas require, plus rejection of undefined members.
Useful in tests and for a CSMS that wants to hold its fleet to the letter of
additionalProperties: false.
Sourcepub const fn lenient() -> Self
pub const fn lenient() -> Self
The knobs field devices actually need: undefined enum values and members are kept, offset-less and space-separated timestamps are accepted, and numeric strings are coerced.
Sourcepub const fn with_max_payload_size(self, bytes: usize) -> Self
pub const fn with_max_payload_size(self, bytes: usize) -> Self
Sets the maximum accepted payload size.
Trait Implementations§
Source§impl Clone for DecodeOptions
impl Clone for DecodeOptions
Source§fn clone(&self) -> DecodeOptions
fn clone(&self) -> DecodeOptions
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more