Skip to main content

register_wkt_types

Function register_wkt_types 

Source
pub fn register_wkt_types(reg: &mut TypeRegistry)
Expand description

Registers all well-known types with the given TypeRegistry.

This registers Duration, Timestamp, FieldMask, Value, Struct, ListValue, Empty, all wrapper types, Any itself, and the remaining official WKTs (Api, Method, Mixin, Type, Field, Enum, EnumValue, Option, SourceContext), enabling both proto3-compliant JSON serialization (under the json feature) and textproto [type_url] { fields } Any-expansion when these types appear inside google.protobuf.Any fields.

Text entries are always registered (buffa-types unconditionally enables buffa/text). JSON entries are registered under the json feature.

ยงExample

use buffa::type_registry::{TypeRegistry, set_type_registry};

let mut reg = TypeRegistry::new();
buffa_types::register_wkt_types(&mut reg);
set_type_registry(reg);