Flint Engine / Guide / API Reference

Module toml_util

Module toml_util 

Source
Expand description

TOML value coercion utilities.

TOML integers and floats are distinct types — 1 parses as integer, 1.0 as float. These helpers coerce either form into Rust numeric types so callers don’t have to repeat the as_float().or_else(|| as_integer().map(...)) dance.

Functions§

toml_color
Extract an RGBA color from a TOML array of 3 (alpha defaults to 1.0) or 4 numbers.
toml_f32
Coerce a TOML integer or float to f32.
toml_f64
Coerce a TOML integer or float to f64.
toml_f32_slice
Coerce every element of a &[Value] slice to f32.
toml_to_vec3
Extract a Vec3 from a TOML value that is either an array [x, y, z] or a table { x = .., y = .., z = .. }.
toml_vec3
Extract [f32; 3] from a TOML array of 3+ numbers.
toml_vec4
Extract [f32; 4] from a TOML array of 4+ numbers.