use std::io::Write;
use lgwks_std::{encoding, glob, hex, retry, time};
fn main() -> Result<(), Box<dyn std::error::Error>> {
let digest = hex::encode(b"hello");
assert_eq!(
digest, "68656c6c6f",
"hex::encode of b\"hello\" must be lowercase hex"
);
let encoded = encoding::base64::encode(b"payload");
assert_eq!(
encoded, "cGF5bG9hZA==",
"base64 of b\"payload\" must be the padded standard encoding"
);
let now = time::now_rfc3339()?;
assert!(
now.ends_with('Z'),
"RFC 3339 UTC output must end in Z, got {now}"
);
assert!(
glob::matches("src/**/*.rs", "src/lib.rs"),
"`src/**/*.rs` must match a nested Rust source file"
);
assert!(
!glob::matches("src/**/*.rs", "README.md"),
"`src/**/*.rs` must not match a Markdown file"
);
let policy = retry::RetryPolicy::new(
3,
std::time::Duration::from_millis(100),
std::time::Duration::from_secs(5),
);
assert!(
policy.should_retry(0, std::time::Duration::ZERO),
"attempt 0 is under a budget of 3 and must retry"
);
let mut out = std::io::stdout();
writeln!(out, "lgwks_std quickstart ok at {now}")?;
Ok(())
}