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
/* Copyright (c) 2026 Richard Rodger and other contributors, MIT License */
//! The order records: what the canonical descriptor orders by statement,
//! kept beside the descriptor rather than in it.
//!
//! The canonical descriptor is a JavaScript object, and an object lists
//! its members in the order they were first assigned. The walk assigns
//! most of them in a fixed order, but three in each of the file, a
//! message and an enum are assigned by the statement that first needs
//! them, so their order is the source's:
//!
//! | container | statement-ordered members |
//! |---|---|
//! | `FileDescriptorProto` | `package`, `optionDependency`, `options` |
//! | `DescriptorProto` | `extensionRange`, `reservedRange`, `reservedName` |
//! | `EnumDescriptorProto` | `reservedRange`, `reservedName`, `options` |
//!
//! The walk records those, by their descriptor JSON names, for every
//! container it builds, in a tree of records beside the descriptor's own,
//! which [`crate::parse_value`], [`crate::parse_value_with`] and
//! [`crate::to_descriptor_value`] read. The descriptor holds none of it,
//! so its public types are what they were before the tree, and two
//! descriptors holding the same values are equal however their sources
//! ordered the statements. [`crate::descriptor_value`], given a
//! descriptor alone, has no record and gives those members in the order
//! the table lists. An option map needs no record: [`crate::Options`]
//! keeps its names in the order the source set them. `go/order.go` is the
//! Go port's record.
use HashMap;
/// The record for one container the walk built: its statement-ordered
/// members, in the order the source first set them, and the records of
/// the messages and enums in its lists, by the list's JSON name and the
/// index there. A container with nothing to record files none.
pub