From 8c3130ee5e8520a3f8aed1a05ee846f7ea460e46 Mon Sep 17 00:00:00 2001 From: vms Date: Mon, 15 Mar 2021 14:24:55 +0300 Subject: [PATCH] auto version figuring out --- wasmer-it/src/ast.rs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/wasmer-it/src/ast.rs b/wasmer-it/src/ast.rs index 4c5d4c1..6f2c1cc 100644 --- a/wasmer-it/src/ast.rs +++ b/wasmer-it/src/ast.rs @@ -141,6 +141,22 @@ pub struct Interfaces<'input> { } impl Interfaces<'_> { + pub fn new() -> Self { + use std::str::FromStr; + + // it's safe because otherwise it won't compile + let version = semver::Version::from_str(env!("CARGO_PKG_VERSION")).unwrap(); + + Self { + version, + types: Vec::new(), + imports: Vec::new(), + adapters: Vec::new(), + exports: Vec::new(), + implementations: Vec::new(), + } + } + pub fn from_version(version: semver::Version) -> Self { Self { version,