diff options
| author | Owen Jacobson <owen@grimoire.ca> | 2024-09-25 12:01:23 -0400 |
|---|---|---|
| committer | Owen Jacobson <owen@grimoire.ca> | 2024-09-25 12:01:23 -0400 |
| commit | fe99056b24034f59516b4da67cab756a05895e8e (patch) | |
| tree | 5aebeaaecec63232c88e478fd92450cf57fd1ca5 | |
| parent | 674a50f84b6fd94fa7d677261a0c8c95ad7f7526 (diff) | |
Re-wrap comments.
| -rw-r--r-- | src/clock.rs | 8 | ||||
| -rw-r--r-- | src/id.rs | 12 | ||||
| -rw-r--r-- | src/repo/login/extract.rs | 7 |
3 files changed, 17 insertions, 10 deletions
diff --git a/src/clock.rs b/src/clock.rs index 81ecede..4774613 100644 --- a/src/clock.rs +++ b/src/clock.rs @@ -8,10 +8,10 @@ use chrono::Utc; pub type DateTime = chrono::DateTime<chrono::Utc>; -// Extractor that provides the "current time" for a request. This time is calculated -// once per request, even if the extractor is used in multiple places. This requires -// the [middleware] function to be installed with [axum::middleware::from_fn] around -// the current route. +// Extractor that provides the "current time" for a request. This time is +// calculated once per request, even if the extractor is used in multiple +// places. This requires the [middleware] function to be installed with +// [axum::middleware::from_fn] around the current route. #[derive(Clone)] pub struct RequestedAt(pub DateTime); @@ -7,7 +7,8 @@ use std::fmt; // * Do not require escaping in hostnames // * Are unique up to case conversion // * Are relatively unlikely to contain cursewords -// * Are relatively unlikely to contain visually similar characters in most typefaces +// * Are relatively unlikely to contain visually similar characters in most +// typefaces // * Are not sequential // // This leaves 23 ASCII characters, or about 4.52 bits of entropy per character @@ -17,16 +18,17 @@ const ALPHABET: [char; 23] = [ 't', 'w', 'x', 'y', ]; -// Pick enough characters per ID to make accidental collisions "acceptably" unlikely -// without also making them _too_ unwieldy. This gives a fraction under 68 bits per ID. +// Pick enough characters per ID to make accidental collisions "acceptably" +// unlikely without also making them _too_ unwieldy. This gives a fraction under +// 68 bits per ID. const ID_SIZE: usize = 15; // Intended to be wrapped in a newtype that provides both type-based separation // from other identifier types, and a unique prefix to allow the intended type // of an ID to be determined by eyeball when debugging. // -// By convention, the prefix should be UPPERCASE - note that the alphabet for this -// is entirely lowercase. +// By convention, the prefix should be UPPERCASE - note that the alphabet for +// this is entirely lowercase. #[derive( Clone, Debug, diff --git a/src/repo/login/extract.rs b/src/repo/login/extract.rs index 92eb516..e5f96d0 100644 --- a/src/repo/login/extract.rs +++ b/src/repo/login/extract.rs @@ -20,7 +20,12 @@ impl FromRequestParts<App> for Login { // After Rust 1.82 (and #[feature(min_exhaustive_patterns)] lands on // stable), the following can be replaced: // - // let Ok(identity_token) = IdentityToken::from_request_parts(parts, state).await; + // ``` + // let Ok(identity_token) = IdentityToken::from_request_parts( + // parts, + // state, + // ).await; + // ``` let identity_token = IdentityToken::from_request_parts(parts, state).await?; let RequestedAt(used_at) = RequestedAt::from_request_parts(parts, state).await?; |
