Module strconv

Source
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.

Modules§

proto_parse_error
Nested message and enum types in ProtoParseError.
proto_parse_hex_error
Nested message and enum types in ProtoParseHexError.

Macros§

bail 🔒

Structs§

ListElementEscaper 🔒
ListElementWriter
A helper for format_list that formats a single list element.
MapElementEscaper 🔒
MapValueWriter
A helper for format_map that formats a single map value.
ParseError
An error while parsing an input as a type.
ProtoParseError
ProtoParseHexError
RangeElementWriter
A helper for format_range that formats a single record element.
RecordElementEscaper 🔒
RecordElementWriter
A helper for format_record that formats a single record element.

Enums§

ArrayParsingError 🔒
Nestable
Yes should be provided for types that will never return true for ElementEscaper::needs_escaping
ParseErrorKind
ParseHexError

Traits§

ElementEscaper

Functions§

escape_elem 🔒
Escapes a list, record, or map element in place.
format_acl_item
Writes an acl_item to buf.
format_array
format_array_inner
format_bool
Writes a boolean value into buf.
format_bool_static
Like format_bool, but returns a string with a static lifetime.
format_bytes
format_date
Writes a Date to buf.
format_elems
Writes each elem into buf, separating the elems with sep.
format_float 🔒
format_float32
Writes an f32 to buf.
format_float64
Writes an f64 to buf.
format_int16
Writes an i16 to buf.
format_int32
Writes an i32 to buf.
format_int64
Writes an i64 to buf.
format_interval
format_jsonb
format_jsonb_pretty
format_legacy_vector
format_list
format_map
format_mz_acl_item
Writes an mz_acl_item to buf.
format_mz_timestamp
Writes an mz_timestamp to buf.
format_nanos_to_micros 🔒
format_numeric
format_range
Writes a Range to buf.
format_record
format_string
format_time
Writes a NaiveDateTime timestamp to buf.
format_timestamp
Writes a NaiveDateTime timestamp to buf.
format_timestamptz
Writes a DateTime<Utc> timestamp to buf.
format_uint16
Writes an u16 to buf.
format_uint32
Writes an u32 to buf.
format_uint64
Writes an u64 to buf.
format_uuid
lex_embedded_element 🔒
lex_quoted_element 🔒
lex_unquoted_element 🔒
parse_acl_item
Parses an AclItem from s.
parse_array
parse_array_inner 🔒
parse_bool
Parses a bool from s.
parse_bytes
parse_bytes_hex
parse_bytes_traditional
parse_date
Parses a Date from s.
parse_float 🔒
parse_float32
Parses an f32 from s.
parse_float64
Parses an f64 from s.
parse_int16
Parses an i16 from s.
parse_int32
Parses an i32 from s.
parse_int64
Parses an i64 from s.
parse_interval
parse
parse_interval_w_disambiguator
Parse an interval string, using an optional leading precision for time (H:M:S) and a specific mz_sql_parser::ast::DateTimeField to identify ambiguous elements. For more information about this operation, see the documentation on ParsedDateTime::build_parsed_datetime_interval.
parse_jsonb
parse_legacy_vector
parse_legacy_vector_inner
parse_list
parse_list_inner 🔒
parse_map
parse_map_inner 🔒
parse_mz_acl_item
Parses an MzAclItem from s.
parse_mz_timestamp
Parses an mz_timestamp from s.
parse_numeric
parse_oid
Parses an OID from s.
parse_pg_legacy_name
parse_range
parse_range_inner 🔒
parse_time
Parses a NaiveTime from s, using the following grammar.
parse_timestamp
Parses a NaiveDateTime from s.
parse_timestamp_string 🔒
Use the following grammar to parse s into:
parse_timestamptz
Parses a DateTime<Utc> from s. See mz_expr::scalar::func::timezone_timestamp for timezone anomaly considerations.
parse_uint16
Parses an u16 from s.
parse_uint32
Parses an u32 from s.
parse_uint64
Parses an u64 from s.
parse_uuid