Skip to content

Commit 2b4357e

Browse files
committed
add VERSION and GIT_COMMIT_SHA_SHORT constants
These are useful for logging the ipmpsc version in an application.
1 parent d2724e4 commit 2b4357e

File tree

3 files changed

+15
-8
lines changed

3 files changed

+15
-8
lines changed

Cargo.toml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,22 +6,24 @@ repository = "https://github.com/dicej/ipmpsc"
66
documentation = "https://docs.rs/ipmpsc/"
77
keywords = ["ipc", "shared"]
88
license = "MIT"
9-
version = "0.3.1"
9+
version = "0.3.2"
1010
authors = ["Joel Dice <[email protected]>"]
1111
edition = "2018"
1212
include = [ "Cargo.toml", "LICENSE.md", "README.md", "src/**/*", "examples/**/*" ]
1313

1414
[dependencies]
15-
serde = "1"
15+
serde = { version = "1", features = ["derive"] }
1616
bincode = "1"
1717
tempfile = "3"
1818
memmap = "0.7"
1919
libc = "0.2"
2020
thiserror = "1"
21-
serde_derive = "1"
2221

2322
[dev-dependencies]
2423
anyhow = "1"
2524
proptest = "0.9"
2625
clap = "2"
2726
serde_bytes = "0.11"
27+
28+
[build-dependencies]
29+
vergen = "3"

build.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
use std::error::Error;
2+
use vergen::ConstantsFlags;
3+
4+
fn main() -> Result<(), Box<dyn Error>> {
5+
vergen::generate_cargo_keys(ConstantsFlags::all())
6+
}

src/lib.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,6 @@
77
88
#![deny(warnings)]
99

10-
#[cfg(test)]
11-
#[allow(unused_imports)]
12-
#[macro_use]
13-
extern crate serde_derive;
14-
1510
use memmap::MmapMut;
1611
use serde::{Deserialize, Serialize};
1712
use std::{
@@ -28,6 +23,10 @@ use std::{
2823
use tempfile::NamedTempFile;
2924
use thiserror::Error as ThisError;
3025

26+
pub const VERSION: &str = env!("CARGO_PKG_VERSION");
27+
28+
pub const GIT_COMMIT_SHA_SHORT: &str = env!("VERGEN_SHA_SHORT");
29+
3130
const BEGINNING: u32 = mem::size_of::<Header>() as u32;
3231

3332
const DECADE_SECS: u64 = 60 * 60 * 24 * 365 * 10;

0 commit comments

Comments
 (0)