INNER CODE UNIT · Rust

parse_whole_seconds

pbeets/rithmic-rs · src/config.rs:258

fn parse_whole_seconds(value: &str) -> Option<u64> {
    let canonical = !value.is_empty()
        && value.bytes().all(|b| b.is_ascii_digit())
        && (value == "0" || !value.starts_with('0'));

    if canonical { value.parse().ok() } else { None }
}

/// Where to connect and how to log in. One config can be shared by every
/// plant you connect.
///
/// Build one with [`RithmicConfig::from_env`] or [`RithmicConfig::builder`]; to
/// load from the environment and override a field, use
/// [`RithmicConfigBuilder::from_env`].
///
/// ```no_run
/// use rithmic_rs::{RithmicConfigBuilder, RithmicEnv};
///

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…