pub enum ShapeNode {
Scalar {
name: String,
position: usize,
},
RawScalar,
JsonScalar,
Object {
name: String,
type_name: Option<String>,
position: usize,
cardinality: Cardinality,
pointers: Vec<ShapeNode>,
has_implicit_id: bool,
},
Array {
name: String,
position: usize,
element: Box<ShapeNode>,
},
Tuple {
name: String,
position: usize,
elements: Vec<ShapeNode>,
names: Option<Vec<String>>,
type_name: Option<String>,
},
NamedTuple {
name: String,
position: usize,
type_name: Option<String>,
members: Option<Vec<JsonMember>>,
is_free_object: bool,
},
Enum {
name: String,
position: usize,
enum_type: String,
},
VectorSearch {
object_position: usize,
distance_position: usize,
object_node: Box<ShapeNode>,
},
FtsSearch {
object_position: usize,
rank_position: usize,
object_node: Box<ShapeNode>,
},
Group {
key_nodes: Vec<ShapeNode>,
grouping_position: usize,
elements_position: usize,
element: Box<ShapeNode>,
},
}Expand description
Internal tree describing one position in the query output shape. Opaque to Python — only the Rust deserializer inspects it.
Variants§
Scalar
Leaf value; native PG type.
RawScalar
The result column IS the value — not wrapped in ROW(). Used for array literals
where an array is returned as its own top-level column.
JsonScalar
Like RawScalar but the value is a decoded JSON object (from a Json("...").
Object
Object shape.
type_name = Some(s) → named schema type decoded to a registered dataclass.
type_name = None → free type decoded to Pylon’s generic Object dataclass.
name is the pointer name within the parent (empty string for the root).
Fields
cardinality: CardinalityArray
record[] column decoded to a Python list.
Tuple
A tuple read as the composite row it is: each element at its own
position, carrying its own PostgreSQL type, rather than out of a
jsonb value where every number is one type (see NamedTuple).
position follows the same convention as every other node — the
index of this value inside the row that holds it — except at the
root, where the row is the tuple and there is nothing to index out
of. Decoders dispatch those two cases separately (decode_row /
decode_at_root against decode in the hydrators).
names is None for a positional tuple, which hydrates to a plain
tuple; Some for a named one, which hydrates to a NamedTupleValue
— or, when type_name names a registered @pylon.named_tuple
class, to that class.
Fields
NamedTuple
Named tuple decoded from jsonb. When type_name is Some, hydrated to the registered class.
members carries the full per-member decode plan when statically known (a registered
NamedTupleDescriptor’s members, a structural pylon.Tuple[...] property’s tuple_members,
or a <tuple<...>>/nominal cast’s own target type) — None falls back to decoding the
raw jsonb value generically (dict/list, no per-member typing).
Fields
members: Option<Vec<JsonMember>>is_free_object: boolTrue when this value came from { x := 1.0 } (curly-brace free-
object syntax) rather than (x := 1.0) (paren tuple syntax) —
decoded identically either way (both are jsonb), but the
frontend’s own value-shape-tag tree (pylon/query.py’s
shape_value_tags) uses this to tell the Python API layer to
describe it as an “object” rather than a “namedTuple”, so
JsonTree renders an expandable Object {x: 1.0} instead of a
non-expandable (x := 1.0) tuple literal.
Enum
Enum value arrived as text; hydrated to the Python enum class keyed by enum_type.
VectorSearch
Result of a vector::search statement.
The outer result tuple has three slots:
0 → NULL (virtual type, no registry lookup)
object_position → the object sub-tuple (decoded as a Pylon object)
distance_position → the distance scalar (float64)
FtsSearch
Result of a fts::search statement.
Outer tuple layout mirrors VectorSearch: pos 0 = NULL, pos 1 = object, pos 2 = score.
Group
Result of a group statement: each row is a free object with key/grouping/elements.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ShapeNode
impl RefUnwindSafe for ShapeNode
impl Send for ShapeNode
impl Sync for ShapeNode
impl Unpin for ShapeNode
impl UnsafeUnpin for ShapeNode
impl UnwindSafe for ShapeNode
Blanket Implementations§
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> LayoutRaw for T
impl<T> LayoutRaw for T
Source§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Source§impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
Source§unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
Source§fn resolve_niched(out: Place<NichedOption<T, N1>>)
fn resolve_niched(out: Place<NichedOption<T, N1>>)
out indicating that a T is niched.