Skip to main content

Numbers

Trait Numbers 

Source
pub trait Numbers {
    // Required methods
    fn number(&self, path: &str) -> Result<f64, ConfigError>;
    fn invalid(&self, path: &str) -> ConfigError;

    // Provided methods
    fn positive(&self, path: &str) -> Result<f64, ConfigError> { ... }
    fn non_negative(&self, path: &str) -> Result<f64, ConfigError> { ... }
}
Expand description

Where a linkage reads its numbers: a crate’s tables by their paths (geometry.forearm_m), or a file’s linkage node by the path’s last part (forearm_m), so that one constructor serves both.

Required Methods§

Source

fn number(&self, path: &str) -> Result<f64, ConfigError>

Any finite number.

Source

fn invalid(&self, path: &str) -> ConfigError

The error that refuses the value at path.

Provided Methods§

Source

fn positive(&self, path: &str) -> Result<f64, ConfigError>

Source

fn non_negative(&self, path: &str) -> Result<f64, ConfigError>

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl Numbers for Config

Source§

fn number(&self, path: &str) -> Result<f64, ConfigError>

Source§

fn invalid(&self, path: &str) -> ConfigError

Implementors§