pub fn as_usize_literal(value: &Value) -> Option<usize>Expand description
Resolve a Value into a usize if numeric-shaped.
Accepts:
Value::Number(n, _)— the typed-parameter and explicit-literal path.Value::SingleQuotedString(s)wheresparses asusize— the UNKNOWN-param bind path (pgwire drivers that sendType::UNKNOWN).
Value::DoubleQuotedString is NOT accepted: with the PostgreSQL dialect
double-quoted tokens parse as Expr::Identifier, never as
Expr::Value(Value::DoubleQuotedString), so that variant is unreachable
in practice and routing it here would silently accept non-numeric text.
§Bounds
Valid outputs are [0, usize::MAX] (64-bit on typical targets).
Inputs that don’t fit — negative numbers, fractional values,
values exceeding usize::MAX, non-numeric text — return None.
The caller decides the semantic: a LIMIT site treats None as
“no limit applied” (pre-existing behavior); stricter sites should
surface a planner error.
Does not perform saturating or wrapping coercion — values that
overflow usize are rejected, not silently truncated.