pub enum CastSyntax {
Call,
DoubleColon,
PrefixTyped,
Convert,
}Expand description
How a cast is spelled.
One canonical Expr::Cast shape covers all three spellings; this
tag records which surface form the source used so rendering round-trips: the
standard CAST(expr AS type) call, the PostgreSQL expr::type postfix
operator, or the PostgreSQL prefixed typed string constant type 'string'.
Variants§
Call
CAST(expr AS type).
DoubleColon
expr::type (PostgreSQL).
PrefixTyped
type 'string' — a typed string constant whose semantics are a cast of the
string to the named type (PostgreSQL’s generalized ConstTypename Sconst /
func_name Sconst, e.g. float8 'NaN', int4 '42', double precision '1.5'). The operand is always a string constant; the canonical shape is the
same Expr::Cast as 'NaN'::float8 and CAST('NaN' AS float8), so only
this tag and the rendered spelling distinguish the three.
Convert
CONVERT(<expr>, <type>) — MySQL’s comma-form cast, the same canonical
Expr::Cast shape as CAST(<expr> AS <type>) with only this tag (and the
rendered spelling) distinguishing it. The target is the identical restricted
cast_type set as CAST under
CallSyntax::restricted_cast_targets — engine-measured
on mysql:8.4, CONVERT(1, INT) / CONVERT(x, VARCHAR) reject exactly as the
matching CAST forms do, and the charset-annotated CHAR target rides in free via
the shared type grammar. Recognized only under
CallSyntax::convert_function; MySQL-only. The
transcoding CONVERT(<expr> USING <charset>) form is a different production —
StringFunc::ConvertUsing, not a cast.
Trait Implementations§
Source§impl Clone for CastSyntax
impl Clone for CastSyntax
Source§fn clone(&self) -> CastSyntax
fn clone(&self) -> CastSyntax
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more