pub type AnyTypeEntry = JsonAnyEntry;renamed to JsonAnyEntry
json and (crate features json or text) only.Expand description
Deprecated alias for JsonAnyEntry. Retained for one release cycle.
Aliased Type§
pub struct AnyTypeEntry {
pub type_url: &'static str,
pub to_json: fn(&[u8]) -> Result<Value, String>,
pub from_json: fn(Value) -> Result<Vec<u8>, String>,
pub is_wkt: bool,
}Fields§
§type_url: &'static strThe full type URL (e.g. "type.googleapis.com/google.protobuf.Duration").
to_json: fn(&[u8]) -> Result<Value, String>Serialize: binary Any.value bytes → JSON representation of the
embedded message (without @type).
from_json: fn(Value) -> Result<Vec<u8>, String>Deserialize: JSON representation (without @type) → binary wire
bytes for Any.value. Takes ownership to avoid cloning large values.
is_wkt: boolWhether this type uses "value" wrapping in Any JSON.
WKTs like Duration, Timestamp, FieldMask, Value, Struct, ListValue,
and wrapper types serialize to non-object JSON (strings, numbers,
arrays). In Any, they must be wrapped:
{"@type": "...", "value": <wkt_json>}.
Regular messages serialize to JSON objects and have their fields
inlined: {"@type": "...", "field1": v1, "field2": v2}.
JSON-specific: textproto has no "value" wrapping distinction.