Skip to content

manorom/nml

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 

Repository files navigation

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(())
}

About

Serializing and deserializing Fortran Namelist Input in Rust using Serde

Topics

Resources

Stars

Watchers

Forks

Languages