Skip to content

Commit

Permalink
Add fn to return crate version. (#92)
Browse files Browse the repository at this point in the history
  • Loading branch information
molpopgen authored Jun 9, 2022
1 parent 9f137c2 commit 1b0f5be
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,18 @@ use std::io::Read;

pub use error::DemesError;

const VERSION: &str = env!("CARGO_PKG_VERSION");

pub fn loads(yaml: &str) -> Result<specification::Graph, DemesError> {
specification::Graph::new_resolved_from_str(yaml)
}

pub fn load<T: Read>(reader: T) -> Result<specification::Graph, DemesError> {
specification::Graph::new_resolved_from_reader(reader)
}

/// Return the package version given in the
/// `Cargo.toml` file of this crate.
pub fn version() -> &'static str {
VERSION
}

0 comments on commit 1b0f5be

Please sign in to comment.