Skip to content

Protobuf package name type causes awkward usage in Rust due to reserved keyword #392

@tiyash-basu-frequenz

Description

@tiyash-basu-frequenz

What's needed?

The protobuf package, originally named types, was renamed to type in version v1alpha7 to align with Google's naming conventions, as seen in their google/type package.

While this change creates consistency with Google's APIs, it introduces a stylistic and ergonomic issue in Rust. Since type is a reserved keyword in Rust, developers must use the raw identifier r#type to reference the generated module.

For example, what would ideally be use crate::frequenz::api::common::v1alpha7::type; becomes use crate::frequenz::api::common::v1alpha7::r#type;.

This required use of r#type is not idiomatic in Rust and can be considered stylistically unclean. We should evaluate whether the benefit of aligning with Google's naming convention outweighs the negative impact on the developer experience in Rust.

Proposed solution

Revert it back to types.

Use cases

No response

Alternatives and workarounds

No response

Additional context

No response

Metadata

Metadata

Labels

part:❓We need to figure out which part is affectedpriority:❓We need to figure out how soon this should be addressedtype:enhancementNew feature or enhancement visitble to users

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions