INNER CODE UNIT · Rust
from_env
pbeets/rithmic-rs · src/config.rs:200
pub fn from_env(env: RithmicEnv) -> Result<Self, ConfigError> {
let prefix = env.var_prefix();
Ok(Self {
account_id: require_env(&format!("{prefix}_ACCOUNT_ID"))?,
fcm_id: require_env(&format!("{prefix}_FCM_ID"))?,
ib_id: require_env(&format!("{prefix}_IB_ID"))?,
})
}
}
/// Login overrides. Every field left `None` keeps the default, so `login()` is
/// enough unless you need one of these.
///
/// A plant logs in once per connection. Calling `login_with_config` again with
/// a different config returns [`RithmicError::LoginConflict`](crate::RithmicError::LoginConflict),
/// so pick the config before the first login.
///