pub struct TypedValueJson {
pub value_type: String,
pub value: MetaValueJson,
}Expand description
Tagged-union wire-format for a rustledger_core::MetaValue that
preserves the host’s variant tag.
Used only in DirectiveJson::Custom’s values field, where
callers genuinely need to distinguish (for example) a Date from
a String or an Account — all three of which collapse to a bare
JSON string under the untagged MetaValueJson shape.
Wire shape: {"type": "<variant>", "value": ...} — mirrors
rustledger-ffi-wasi::TypedValue (see
crates/rustledger-ffi-wasi/src/types/output.rs::TypedValue) so
portable JS consumers see identical envelopes across both bindings.
Why value: MetaValueJson and not serde_json::Value —
serde_json is intentionally a host-only dev-dependency for this
crate (the runtime build avoids it to keep the wasm32 dep chain
small). MetaValueJson already covers every payload shape
FFI-WASI’s TypedValue emits: String for the string-flavored
variants, Bool for bool, Amount for amount, Null for
null. The serialized JSON is bit-identical to FFI-WASI’s.
MetaValueJson (untagged) is retained for the meta map of every
directive — there the lossy shape is intentional and matches what
FFI-WASI’s metadata side also emits.
Breaking change from #1199 for the WASM binding: pre-#1207
Custom.values emitted raw MetaValueJson values (lossy). Closes
#1207.
Fields§
§value_type: StringVariant tag — one of "string", "account", "currency",
"tag", "link", "date", "number", "bool", "amount",
"null". Matches FFI-WASI’s tag strings exactly.
Renamed via #[ts(type = ...)] so the discriminator is a
string-literal union on the TS side. The post-process script
further narrows the full struct shape into a discriminated
union (per-variant {type, value} rows) – see ADR-0004 for
why the narrowing is hand-tuned rather than generator-driven.
value: MetaValueJsonVariant payload (see MetaValueJson for the four shapes).
Trait Implementations§
Source§impl Clone for TypedValueJson
impl Clone for TypedValueJson
Source§fn clone(&self) -> TypedValueJson
fn clone(&self) -> TypedValueJson
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for TypedValueJson
impl Debug for TypedValueJson
Source§impl<'de> Deserialize<'de> for TypedValueJson
impl<'de> Deserialize<'de> for TypedValueJson
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for TypedValueJson
impl RefUnwindSafe for TypedValueJson
impl Send for TypedValueJson
impl Sync for TypedValueJson
impl Unpin for TypedValueJson
impl UnsafeUnpin for TypedValueJson
impl UnwindSafe for TypedValueJson
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,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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 moreSource§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.