Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: impl Name for some well-known types #933

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

sillykelvin
Copy link

Implement the newly added Name trait for well-known wrapper types, e.g. google.protobuf.Empty.

@sillykelvin
Copy link
Author

sillykelvin commented Oct 17, 2023

The CI failed due to compiler version requirement mismatch:

error: package regex-syntax v0.8.2 cannot be built because it requires rustc 1.65 or newer, while the currently active rustc version is 1.64.0

Anyone who knows how to fix the CI failure? Thanks!

Copy link
Collaborator

@caspermeijn caspermeijn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please rebase to latest master to fix CI.

I would like to see some tests. You could add something like this to tests/src/type_names.rs:

    assert_eq!("BoolValue", bool::NAME);
    assert_eq!("google.protobuf", bool::PACKAGE);
    assert_eq!("google.protobuf.BoolValue", bool::full_name());
    assert_eq!("type.googleapis.com/google.protobuf.BoolValue", bool::type_url());


/// Compute the type URL for the given `google.protobuf` type, using `type.googleapis.com` as the
/// authority for the URL.
fn type_url_for<T: Name>() -> String {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function is specific to googleapis url. I would reflect that in the function name.

Suggested change
fn type_url_for<T: Name>() -> String {
fn googleapis_type_url_for<T: Name>() -> String {

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants