pub struct ValueFormatter<'a> { /* private fields */ }Expand description
Formatter for runtime values represented as KindedSlot.
Uses TypeSchemaRegistry to format TypedObject payloads with
their schema-declared field names. Optionally accepts a reference
resolver (Phase-2c) that dereferences ref-kind slots to their target
values; absent the resolver, refs print as <ref>.
ADR-005 §1 single-discriminator preserved: heap arms are read via
the slot’s typed pointer + HeapValue match (Q8 ruling). No
per-heap-variant accessors on KindedSlot; no parallel sum types.
Implementations§
Source§impl<'a> ValueFormatter<'a>
impl<'a> ValueFormatter<'a>
Sourcepub fn new(schema_registry: &'a TypeSchemaRegistry) -> Self
pub fn new(schema_registry: &'a TypeSchemaRegistry) -> Self
Create a formatter without a reference resolver — Ref-kind
slots will print as <ref>.
Sourcepub fn with_deref(
schema_registry: &'a TypeSchemaRegistry,
deref_fn: &'a dyn Fn(&KindedSlot) -> Option<KindedSlot>,
) -> Self
pub fn with_deref( schema_registry: &'a TypeSchemaRegistry, deref_fn: &'a dyn Fn(&KindedSlot) -> Option<KindedSlot>, ) -> Self
Create a formatter with a reference resolver. The resolver is
invoked when a ref-kind slot is encountered; if it returns
Some(target) the target is formatted in place, otherwise the
ref prints as <ref>.
Sourcepub fn format_kinded(&self, slot: &KindedSlot) -> String
pub fn format_kinded(&self, slot: &KindedSlot) -> String
Primary entry point: format a runtime value to a string.
At the top level, raw strings render unquoted (so print("hi")
prints hi, not "hi"). Inside containers (TypedObject fields,
HashMap values, heap-array elements) strings are quoted via
Self::format_kinded_nested.
Sourcepub fn format_kinded_nested(&self, slot: &KindedSlot) -> String
pub fn format_kinded_nested(&self, slot: &KindedSlot) -> String
Format a runtime value as it appears nested inside another
container — quotes string values to disambiguate {name: "alice"}
vs {name: alice}.
Auto Trait Implementations§
impl<'a> Freeze for ValueFormatter<'a>
impl<'a> !RefUnwindSafe for ValueFormatter<'a>
impl<'a> !Send for ValueFormatter<'a>
impl<'a> !Sync for ValueFormatter<'a>
impl<'a> Unpin for ValueFormatter<'a>
impl<'a> UnsafeUnpin for ValueFormatter<'a>
impl<'a> !UnwindSafe for ValueFormatter<'a>
Blanket Implementations§
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> 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> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more