nml

Crates.ionml
lib.rsnml
version0.2.0
sourcesrc
created_at2023-11-01 15:33:26.990115
updated_at2024-02-18 18:21:42.143409
descriptionA parser and Serde implementation for the Fortran Namelist format
homepage
repositoryhttps://github.com/manorom/nml/
max_upload_size
id1021203
size83,560
(manorom)

documentation

README

nml

Serialize and deserialize Fortran namelist input in Rust using the serde framework.

Usage

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(())
}
Commit count: 3

cargo fmt