pub fn flatten_for_registry(
fds: &FileDescriptorSet,
root_fqn: &str,
) -> Result<DescriptorProto, FlattenError>Expand description
Flattens fds into a single self-contained DescriptorProto rooted at
root_fqn, grafting the transitive closure of top-level ancestors and
rewriting type references so a shallow, nested_type-only registry can
resolve them. See the module documentation for the algorithm.
§Errors
Returns a FlattenError if root_fqn is not a top-level message
(FlattenError::RootNotFound/FlattenError::RootIsNested), if a
referenced type is missing from the set (FlattenError::UnresolvedType -
compile with protoc --include_imports), or if a grafted name cannot be
disambiguated (FlattenError::NameCollision).
§Panics
Does not panic in normal use: the worklist only ever contains type names already present in the index, which an internal assertion documents.