A better Rust ATProto crate
1

Configure Feed

Select the types of activity you want to include in your feed.

at main 497 B View raw
1use std::time::Duration; 2 3const YEAR_SECONDS: u64 = 365 * 24 * 3600; 4 5pub(crate) fn ensure_expirations_or_panic( 6 time_to_live: Option<Duration>, 7 time_to_idle: Option<Duration>, 8) { 9 let max_duration = Duration::from_secs(1_000 * YEAR_SECONDS); 10 if let Some(d) = time_to_live { 11 assert!(d <= max_duration, "time_to_live is longer than 1000 years"); 12 } 13 if let Some(d) = time_to_idle { 14 assert!(d <= max_duration, "time_to_idle is longer than 1000 years"); 15 } 16}