parse

Function parse 

Source
pub fn parse<P: Read>(
    reader: BufReader<P>,
    type_: FileType,
) -> Result<(Vec<Atom>, Vec<Bond>)>
Expand description

Parses a file based on the FileType and returns a vector of Atom and a vector of Bond objects.

ยงExamples

use chelate;
use chelate::FileType;
use std::fs::File;
use std::io::BufReader;

let file = File::open("data/147288.cif").unwrap();
let reader = BufReader::new(file);
let (atoms, bonds) = chelate::parse(reader, FileType::CIF).unwrap();

assert_eq!(atoms.len(), 206);
assert_eq!(bonds.len(), 230);