Module repr::strconv [−][src]
Expand description
Routines for converting datum values to and from their string representation.
The functions in this module are tightly related to the variants of
ScalarType. Each variant has a pair of functions in
this module named parse_VARIANT and format_VARIANT. The type returned
by parse functions, and the type accepted by format functions, will
be a type that is easily converted into the Datum variant
for that type. The functions do not directly convert from Datums to
Strings so that the logic can be reused when Datums are not available or
desired, as in the pgrepr crate.
The string representations used are exactly the same as the PostgreSQL string representations for the corresponding PostgreSQL type. Deviations should be considered a bug.
Macros
Structs
A helper for format_list that formats a single list element.
A helper for format_map that formats a single map value.
An error while parsing an input as a type.
A helper for format_record that formats a single record element.
Enums
Yes should be provided for types that will never return true for ElementEscaper::needs_escaping
Traits
Functions
Escapes a list, record, or map element in place.
Writes a boolean value into buf.
Like format_bool, but returns a string with a static lifetime.
Writes a NaiveDate to buf.
Writes an f32 to buf.
Writes an f64 to buf.
Writes an i16 to buf.
Writes an i32 to buf.
Writes an i64 to buf.
Writes a NaiveDateTime timestamp to buf.
Writes a NaiveDateTime timestamp to buf.
Writes a DateTime<Utc> timestamp to buf.
Parses a bool from s.
Parses a NaiveDate from s.
Parses an f32 from s.
Parses an f64 from s.
Parses an i16 from s.
Parses an i32 from s.
Parses an i64 from s.
parse
Parse an interval string, using an optional leading precision for time (H:M:S) and a specific sql_parser::ast::DateTimeField to identify ambiguous elements. For more information about this operation, see the documentation on ParsedDateTime::build_parsed_datetime_interval.
Parses a NaiveTime from s, using the following grammar.
Parses a NaiveDateTime from s.
Use the following grammar to parse s into:
Parses a DateTime<Utc> from s. See expr::scalar::func::timezone_timestamp for timezone anomaly considerations.