Skip to main content

limits_from_toml_str

Function limits_from_toml_str 

pub fn limits_from_toml_str(raw: &str) -> Result<BrokerLimits, ConfigError>
Expand description

Reads the [tbank] section of a limits file given as text.

Use it to replace the bundled figures, for example after GetUserTariff showed that your tariff has other limits.

§Errors

[ConfigError::Message] when the text is not valid TOML, the [tbank] section is missing, or it is invalid.

§Examples

use brokapi_tbank::limits::{limits_from_toml_str, DEFAULT_LIMITS_TOML};

assert!(limits_from_toml_str(DEFAULT_LIMITS_TOML).is_ok());
// A file without a `[tbank]` section is refused.
assert!(limits_from_toml_str("[bcs.conns]").is_err());