Crates.io | nml |
lib.rs | nml |
version | 0.2.0 |
source | src |
created_at | 2023-11-01 15:33:26.990115 |
updated_at | 2024-02-18 18:21:42.143409 |
description | A parser and Serde implementation for the Fortran Namelist format |
homepage | |
repository | https://github.com/manorom/nml/ |
max_upload_size | |
id | 1021203 |
size | 83,560 |
Serialize and deserialize Fortran namelist input in Rust using the serde framework.
use serde::Deserialize;
#[derive(Deserialize, Debug)]
struct Particle {
index: i32,
position: [f32; 3],
velocity: [f32; 3]
}
fn main() -> Result<(), nml::NamelistError>{
let s = r#"
&particle
index = 0,
position = 0.0, 0.0, 0.0,
velocity = 1.0, 0.0, 0.0,
/"#;
let particle: Particle = nml::group_from_str(s)?.1;
println!("{:#?}", particle);
Ok(())
}