Skip to content

Commit

Permalink
Rename to be consistent with Rust self conventions
Browse files Browse the repository at this point in the history
Signed-off-by: Thane Thomson <[email protected]>
  • Loading branch information
thanethomson committed Jun 21, 2021
1 parent 53c1a50 commit c005d4d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions proto/src/serializers/timestamp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ where
}
match Utc.timestamp_opt(value.seconds, value.nanos as u32) {
LocalResult::None => Err(S::Error::custom("invalid time")),
LocalResult::Single(t) => Ok(to_rfc3339_nanos(&t)),
LocalResult::Single(t) => Ok(as_rfc3339_nanos(&t)),
LocalResult::Ambiguous(_, _) => Err(S::Error::custom("ambiguous time")),
}?
.serialize(serializer)
Expand All @@ -58,7 +58,7 @@ where
/// This reproduces the behavior of Go's `time.RFC3339Nano` format,
/// ie. a RFC3339 date-time with left-padded subsecond digits without
/// trailing zeros and no trailing dot.
pub fn to_rfc3339_nanos(t: &DateTime<Utc>) -> String {
pub fn as_rfc3339_nanos(t: &DateTime<Utc>) -> String {
use chrono::format::{Fixed, Item, Numeric::*, Pad::Zero};

const PREFIX: &[Item<'_>] = &[
Expand Down
2 changes: 1 addition & 1 deletion tendermint/src/time.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ impl Time {

/// Return an RFC 3339 and ISO 8601 date and time string with 6 subseconds digits and Z.
pub fn as_rfc3339(&self) -> String {
timestamp::to_rfc3339_nanos(&self.0)
timestamp::as_rfc3339_nanos(&self.0)
}
}

Expand Down

0 comments on commit c005d4d

Please sign in to comment.