Skip to main content

Module de

Module de 

Source
Expand description

Lenient deserializers used by the generated response types.

Slack returns some fields as a string in one place and a number in another (ts, date_created, post_at, …). These functions accept such variations so that one unexpected type does not fail the whole response. They read values directly through a Visitor, without an intermediate tree.

Functions§

opt_bool
Reads a boolean; 0/1 and "true"/"false" are accepted.
opt_f64
Reads a float; numeric strings are accepted.
opt_i64
Reads an integer; numeric strings and floats (truncated) are accepted.
opt_object
Reads an object; null and non-object values ("", false, …) become None.
opt_string
Reads a string; numbers and booleans are converted to strings.
vec
Reads an array; null and non-array values become an empty Vec.