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

impl Duration::{Display, FromStr} with protobuf format #625

Merged
merged 2 commits into from
Apr 20, 2022

Conversation

danburkert
Copy link
Collaborator

This PR implements to and from string methods for
prost_types::Duration following the duration format defined by the
Protobuf JSON mapping spec.

This is a followup to #615 and re-uses a lot of the same parser helpers.
Additionally I did the same error type unification with a new
DurationError type. This is a breaking change for prost-types since
public APIs are changed slightly.

This PR implements to and from string methods for
`prost_types::Duration` following the duration format defined by the
[Protobuf JSON mapping spec][1].

This is a followup to #615 and re-uses a lot of the same parser helpers.
Additionally I did the same error type unification with a new
`DurationError` type. This is a breaking change for `prost-types` since
public APIs are changed slightly.

[1]: https://developers.google.com/protocol-buffers/docs/proto3#json
@danburkert danburkert changed the title impl Timestamp::{Display, FromStr} with RFC-3339 format impl Duration::{Display, FromStr} with protobuf format Apr 14, 2022
Copy link
Member

@LucioFranco LucioFranco left a comment

Choose a reason for hiding this comment

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

LGTM there are a few clippy warnings we should probably clean up before merging

@danburkert danburkert merged commit 8667afc into master Apr 20, 2022
@danburkert danburkert deleted the prost-types-time branch April 20, 2022 20:38
benesch added a commit to MaterializeInc/prost that referenced this pull request May 21, 2022
neacsu added a commit to neacsu/cosmos-rust that referenced this pull request Jun 29, 2022
Expose MsgGrantAllowance, MsgRevokeAllowance, BasicAllowance and
AllowedMsgAllowance from cosmrs.

The current prost-types dependency version doesn't support proper
Duration error propagation, which should be fixed when
tokio-rs/prost#625 is included in a release.
Until then, I only included the code for PeriodicAllowance as commented.
neacsu added a commit to neacsu/cosmos-rust that referenced this pull request Jul 4, 2022
Expose MsgGrantAllowance, MsgRevokeAllowance, BasicAllowance and
AllowedMsgAllowance from cosmrs.

The current prost-types dependency version doesn't support proper
Duration error propagation, which should be fixed when
tokio-rs/prost#625 is included in a release.
Until then, I only included the code for PeriodicAllowance as commented.
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.

2 participants