Skip to content

feat: added format_units_with #936

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

Merged
merged 4 commits into from
Apr 22, 2025
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fmt
  • Loading branch information
Rimeeeeee committed Apr 21, 2025
commit 8618d3439147eff466908db3fe9b14eabe2962d7
2 changes: 2 additions & 0 deletions crates/primitives/src/utils/units.rs
Original file line number Diff line number Diff line change
Expand Up @@ -284,12 +284,14 @@ impl ParseUnits {
}
}
}

/// Formats the given number of Wei as the given unit.
///
/// See [`format_units`] for more information.
pub fn format_units(&self, unit: Unit) -> String {
self.format_units_with(unit, DecimalSeparator::Period)
}

/// Returns `true` if the number is signed.
#[inline]
pub const fn is_signed(&self) -> bool {
Expand Down
Loading