Skip to main content

DecodedValue

Enum DecodedValue 

Source
pub enum DecodedValue {
Show 17 variants Null, Bool(bool), I64(i64), F64(f64), Str(String), Bytes(Vec<u8>), Uuid([u8; 16]), Decimal(String), Interval { months: i32, days: i32, microseconds: i64, }, Date(i32), Time(i64), Timestamp(i64), Timestamptz(i64), Array(Vec<DecodedValue>), Composite(Vec<DecodedValue>), Object(Vec<(String, DecodedValue)>), Range { lower: Option<Box<DecodedValue>>, upper: Option<Box<DecodedValue>>, inc_lower: bool, inc_upper: bool, empty: bool, },
}

Variants§

§

Null

§

Bool(bool)

§

I64(i64)

§

F64(f64)

§

Str(String)

§

Bytes(Vec<u8>)

§

Uuid([u8; 16])

Raw 16-byte UUID, matching QueryParam::Uuid’s own convention in pylon-core. Stored as raw bytes rather than a uuid::Uuid field (every consuming crate already re-wraps this in its own richer type on the way out — e.g. pylon-client’s Value::Uuid(uuid::Uuid) — so there’s no benefit to carrying that type this deep); uuid is still a dependency of this crate, purely so From<uuid::Uuid> below can convert into this variant without every caller writing .into_bytes() by hand.

§

Decimal(String)

Arbitrary-precision decimal, stored as its canonical string form (matches how _pg_decode_numeric round-trips today) rather than a lossy f64 or a bespoke bignum encoding.

§

Interval

A PostgreSQL interval — backs both Pylon’s std::duration (months always 0 by convention) and cal::relative_duration (months may be nonzero). Kept as the three raw wire components rather than folded into a single duration, since months (a calendar-relative unit — “1 month” isn’t a fixed number of days) can’t be losslessly combined with days/microseconds without a reference date.

Fields

§months: i32
§days: i32
§microseconds: i64
§

Date(i32)

PostgreSQL date — whole days since the PG epoch (2000-01-01), exactly as the wire encodes it. Backs cal::local_date.

§

Time(i64)

PostgreSQL time (no timezone) — microseconds since midnight, exactly as the wire encodes it. Backs cal::local_time.

§

Timestamp(i64)

PostgreSQL timestamp (no timezone) — microseconds since the PG epoch (2000-01-01T00:00:00), exactly as the wire encodes it. Backs cal::local_datetime; decodes to a naive datetime.datetime.

§

Timestamptz(i64)

PostgreSQL timestamptz — microseconds since the PG epoch (2000-01-01T00:00:00 UTC; PostgreSQL always normalizes timestamptz to UTC on the wire, regardless of session timezone), exactly as the wire encodes it. Backs std::datetime; decodes to a UTC-aware datetime.datetime. A distinct variant from Timestamp (not a shared representation with a tag) so decode/encode can’t mix up naive vs. aware at the type level.

§

Array(Vec<DecodedValue>)

A genuine Postgres array (text[], int8[], …) — reconstructed Python-side as a list, matching what has always decoded a Postgres array into. Do not use this for a composite/record’s positional fields; see Composite.

§

Composite(Vec<DecodedValue>)

A positional composite (record — a schema object’s own field tuple, or a nested ROW(...)), reconstructed Python-side as a tuple, matching a record row’s own behavior — critically, isinstance(a_tuple, (dict, list)) is False, the same as a real a record row, which pylon.query._decode()’s "named_tuple" case relies on to tell “this position holds a raw jsonb value” apart from “this position holds a composite that needs value[pos] indexing first.” Using Array (→ list) here instead silently breaks that check — a real bug caught by comparing decoded output against the live driver path on real queries.

§

Object(Vec<(String, DecodedValue)>)

Field name + value pairs, in shape order (not a map — field order is part of what ShapeNode positions describe, and duplicate names can’t happen for a single object’s own pointers).

§

Range

A PostgreSQL range value (int8range, numrange, tsrange, tstzrange, daterange, …). lower/upper are None for an unbounded side; empty == true means the whole range is empty (lower/upper are meaningless in that case, not “both unbounded” — PostgreSQL’s own binary encoding distinguishes the two). A multirange<T> decodes to a plain Array of these, not a separate variant — it’s just an ordered collection of ranges.

Fields

§inc_lower: bool
§inc_upper: bool
§empty: bool

Trait Implementations§

Source§

impl Archive for DecodedValue

Source§

type Archived = ArchivedDecodedValue

The archived representation of this type. Read more
Source§

type Resolver = DecodedValueResolver

The resolver for this type. It must contain all the additional information from serializing needed to make the archived type from the normal type.
Source§

fn resolve( &self, resolver: <DecodedValue as Archive>::Resolver, out: Place<<DecodedValue as Archive>::Archived>, )

Creates the archived version of this value at the given position and writes it to the given output. Read more
Source§

const COPY_OPTIMIZATION: CopyOptimization<Self> = _

An optimization flag that allows the bytes of this type to be copied directly to a writer instead of calling serialize. Read more
Source§

impl Clone for DecodedValue

Source§

fn clone(&self) -> DecodedValue

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for DecodedValue

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl<__D> Deserialize<DecodedValue, __D> for <DecodedValue as Archive>::Archived

Source§

fn deserialize( &self, deserializer: &mut __D, ) -> Result<DecodedValue, <__D as Fallible>::Error>

Deserializes using the given deserializer
Source§

impl From<&str> for DecodedValue

Source§

fn from(value: &str) -> DecodedValue

Converts to this type from the input type.
Source§

impl From<String> for DecodedValue

Source§

fn from(value: String) -> DecodedValue

Converts to this type from the input type.
Source§

impl From<Uuid> for DecodedValue

Source§

fn from(value: Uuid) -> DecodedValue

Converts to this type from the input type.
Source§

impl From<Vec<u8>> for DecodedValue

Source§

fn from(value: Vec<u8>) -> DecodedValue

Converts to this type from the input type.
Source§

impl From<bool> for DecodedValue

Source§

fn from(value: bool) -> DecodedValue

Converts to this type from the input type.
Source§

impl From<f32> for DecodedValue

Source§

fn from(value: f32) -> DecodedValue

Converts to this type from the input type.
Source§

impl From<f64> for DecodedValue

Source§

fn from(value: f64) -> DecodedValue

Converts to this type from the input type.
Source§

impl From<i16> for DecodedValue

Source§

fn from(value: i16) -> DecodedValue

Converts to this type from the input type.
Source§

impl From<i32> for DecodedValue

Source§

fn from(value: i32) -> DecodedValue

Converts to this type from the input type.
Source§

impl From<i64> for DecodedValue

Source§

fn from(value: i64) -> DecodedValue

Converts to this type from the input type.
Source§

impl PartialEq for DecodedValue

Source§

fn eq(&self, other: &DecodedValue) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl PartialEq<ArchivedDecodedValue> for DecodedValue

Source§

fn eq(&self, other: &ArchivedDecodedValue) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl<__S> Serialize<__S> for DecodedValue
where __S: Fallible + Writer + Allocator + ?Sized, bool: Serialize<__S>, i64: Serialize<__S>, f64: Serialize<__S>, String: Serialize<__S>, Vec<u8>: Serialize<__S>, [u8; 16]: Serialize<__S>, i32: Serialize<__S>,

Source§

fn serialize( &self, serializer: &mut __S, ) -> Result<<DecodedValue as Archive>::Resolver, <__S as Fallible>::Error>

Writes the dependencies for the object and returns a resolver that can create the archived type.
Source§

impl StructuralPartialEq for DecodedValue

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> ArchivePointee for T

Source§

type ArchivedMetadata = ()

The archived version of the pointer metadata for this type.
Source§

fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata

Converts some archived metadata to the pointer metadata for itself.
Source§

impl<T> ArchiveUnsized for T
where T: Archive,

Source§

type Archived = <T as Archive>::Archived

The archived counterpart of this type. Unlike Archive, it may be unsized. Read more
Source§

fn archived_metadata( &self, ) -> <<T as ArchiveUnsized>::Archived as ArchivePointee>::ArchivedMetadata

Creates the archived version of the metadata for this value.
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> LayoutRaw for T

Source§

fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>

Returns the layout of the type.
Source§

impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
where T: SharedNiching<N1, N2>, N1: Niching<T>, N2: Niching<T>,

Source§

unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool

Returns whether the given value has been niched. Read more
Source§

fn resolve_niched(out: Place<NichedOption<T, N1>>)

Writes data to out indicating that a T is niched.
Source§

impl<T> Pointee for T

Source§

type Metadata = ()

The metadata type for pointers and references to this type.
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, S> SerializeUnsized<S> for T
where T: Serialize<S>, S: Fallible + Writer + ?Sized,

Source§

fn serialize_unsized( &self, serializer: &mut S, ) -> Result<usize, <S as Fallible>::Error>

Writes the object and returns the position of the archived type.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.