Using gorder as a Rust crate

gorder can also be used as a Rust crate, allowing you to call it directly from your Rust code.

To use gorder in your project, first add it as a dependency:

$ cargo add gorder

Next, include the crate into your Rust code:

#![allow(unused)]
fn main() {
use gorder::prelude::*;
}

Once imported, you can access all the options and functionality described in this manual.

For instance, the following configuration YAML file:

structure: system.tpr
trajectory: md.xtc
analysis_type: !CGOrder
  beads: "@membrane"
output: order.yaml

can also by written as the following Rust code:

#![allow(unused)]
fn main() {
let analysis = Analysis::builder()
    .structure("system.tpr")
    .trajectory("md.xtc")
    .analysis_type(AnalysisType::cgorder("@membrane"))
    .output("order.yaml")
    .build()?;
}

You can then run the analysis like this:

#![allow(unused)]
fn main() {
let results = analysis.run()?;
}

and either write the results into the output file(s):

#![allow(unused)]
fn main() {
results.write()?;
}

or access them programmatically.

See the Rust API documentation on docs.rs for more information about using gorder as a Rust crate.