1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
//! Native, pure-Rust protobuf reflection.
//!
//! This module provides a self-contained reflection stack built directly on
//! [`oxiproto_core::wire`], independent of `prost-reflect`:
//!
//! - [`DescriptorPool`] — built from a [`prost_types::FileDescriptorSet`],
//! with fully-qualified-name lookups and iterators.
//! - The descriptor type set: [`FileDescriptor`], [`MessageDescriptor`],
//! [`FieldDescriptor`], [`EnumDescriptor`], [`EnumValueDescriptor`],
//! [`OneofDescriptor`], [`ServiceDescriptor`], [`MethodDescriptor`], plus the
//! [`Kind`] and [`Cardinality`] enums.
//! - [`DynamicMessage`] — runtime message with field get/set, oneof
//! exclusivity, and protobuf wire encode/decode.
//! - [`Value`] / [`MapKey`] — the runtime field value model.
//!
//! These types are exposed under the `native` namespace (and re-exported from
//! the crate root with a `Native`-prefix) so they coexist with the existing
//! `prost-reflect`-backed surface without name collisions.
//!
//! # Example
//!
//! ```
//! use oxiproto_reflect::native::{DescriptorPool, DynamicMessage, Value};
//! use prost_types::{
//! DescriptorProto, FieldDescriptorProto, FileDescriptorProto, FileDescriptorSet,
//! };
//! use prost_types::field_descriptor_proto::{Label, Type};
//!
//! // Build a descriptor set for `message M { int32 a = 1; }`.
//! let fds = FileDescriptorSet {
//! file: vec![FileDescriptorProto {
//! name: Some("m.proto".to_owned()),
//! syntax: Some("proto3".to_owned()),
//! message_type: vec![DescriptorProto {
//! name: Some("M".to_owned()),
//! field: vec![FieldDescriptorProto {
//! name: Some("a".to_owned()),
//! number: Some(1),
//! label: Some(Label::Optional as i32),
//! r#type: Some(Type::Int32 as i32),
//! ..Default::default()
//! }],
//! ..Default::default()
//! }],
//! ..Default::default()
//! }],
//! };
//!
//! let pool = DescriptorPool::from_file_descriptor_set(fds).unwrap();
//! let m = pool.get_message_by_name("M").unwrap();
//! let field = m.get_field(1).unwrap();
//!
//! let mut msg = DynamicMessage::new(m);
//! msg.set_field(&field, Value::I32(150));
//!
//! // Canonical protobuf encoding of `{ a: 150 }` is `08 96 01`.
//! assert_eq!(msg.encode_to_vec().unwrap(), vec![0x08, 0x96, 0x01]);
//! ```
pub use ;
pub use DynamicMessage;
pub use JsonError as NativeJsonError;
pub use ;
pub use TextError as NativeTextError;
pub use ;