Skip to main content

get_list

Function get_list 

Source
pub fn get_list<T: FromStr<Err = Error>>(path: &Path) -> Result<Vec<T>>
Examples found in repository?
examples/parse_dlist.rs (line 7)
5fn main() -> anyhow::Result<()> {
6    let path = Path::new("files/DLIST.lis");
7    let vals: Vec<Dlist> = get_list(path)?;
8
9    println!("DLIST: {} records", vals.len());
10    for (i, v) in vals.iter().take(5).enumerate() {
11        println!("{i}: {v:?}");
12    }
13
14    Ok(())
15}
More examples
Hide additional examples
examples/parse_elist.rs (line 7)
5fn main() -> anyhow::Result<()> {
6    let path = Path::new("files/ELIST.lis");
7    let elems: Vec<Elist> = get_list(path)?;
8
9    println!("ELIST: {} records", elems.len());
10    for (i, e) in elems.iter().take(5).enumerate() {
11        println!("{i}: {e:?}");
12    }
13
14    Ok(())
15}
examples/parse_nlist.rs (line 7)
5fn main() -> anyhow::Result<()> {
6    let path = Path::new("files/NLIST.lis");
7    let nodes: Vec<Nlist> = get_list(path)?;
8
9    println!("NLIST: {} records", nodes.len());
10    for (i, n) in nodes.iter().take(5).enumerate() {
11        println!("{i}: {n:?}");
12    }
13
14    Ok(())
15}
examples/parse_prnsol.rs (line 7)
5fn main() -> anyhow::Result<()> {
6    let path = Path::new("files/PRNSOL.lis");
7    let vals: Vec<Prnsol> = get_list(path)?;
8
9    println!("PRNSOL: {} records", vals.len());
10    for (i, v) in vals.iter().take(5).enumerate() {
11        println!("{i}: {v:?}");
12    }
13
14    Ok(())
15}