Skip to main content

normalize_extern_path_proto_name

Function normalize_extern_path_proto_name 

Source
pub fn normalize_extern_path_proto_name(value: &str) -> Result<String, String>
Expand description

Normalize and validate the proto side of one extern_path mapping.

Trims whitespace, adds the leading dot if absent, drops one trailing dot, and rejects a name with an empty segment (my..common) or with a segment that is not a protobuf identifier (my.common-name). Such a name matches no type, so a typo would otherwise leave the mapping silently unused. ".", the catch-all, is returned as is.

The protoc-gen-reallyme-buffa option parser and buffa-build both run entries through this function, so the two front ends accept the same names.

§Errors

Returns the user-facing message for a malformed name, quoting the name as given. The error is a plain String for the reason normalize_exclude_package gives.