refactor: format
cargo fmt
This commit is contained in:
committed by
Greg Heartsfield
parent
440217e1ee
commit
6df92f9580
+6
-3
@@ -4,7 +4,8 @@ use std::time::SystemTime;
|
||||
use url::Url;
|
||||
|
||||
/// Seconds since 1970.
|
||||
#[must_use] pub fn unix_time() -> u64 {
|
||||
#[must_use]
|
||||
pub fn unix_time() -> u64 {
|
||||
SystemTime::now()
|
||||
.duration_since(SystemTime::UNIX_EPOCH)
|
||||
.map(|x| x.as_secs())
|
||||
@@ -12,7 +13,8 @@ use url::Url;
|
||||
}
|
||||
|
||||
/// Check if a string contains only hex characters.
|
||||
#[must_use] pub fn is_hex(s: &str) -> bool {
|
||||
#[must_use]
|
||||
pub fn is_hex(s: &str) -> bool {
|
||||
s.chars().all(|x| char::is_ascii_hexdigit(&x))
|
||||
}
|
||||
|
||||
@@ -28,7 +30,8 @@ pub fn nip19_to_hex(s: &str) -> Result<String, bech32::Error> {
|
||||
}
|
||||
|
||||
/// Check if a string contains only lower-case hex chars.
|
||||
#[must_use] pub fn is_lower_hex(s: &str) -> bool {
|
||||
#[must_use]
|
||||
pub fn is_lower_hex(s: &str) -> bool {
|
||||
s.chars().all(|x| {
|
||||
(char::is_ascii_lowercase(&x) || char::is_ascii_digit(&x)) && char::is_ascii_hexdigit(&x)
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user