Skip to main content

rust_ethernet_ip/
version.rs

1/// Library version information
2pub const VERSION: &str = env!("CARGO_PKG_VERSION");
3/// Cargo package name compiled into the library.
4pub const NAME: &str = env!("CARGO_PKG_NAME");
5/// Cargo package description compiled into the library.
6pub const DESCRIPTION: &str = env!("CARGO_PKG_DESCRIPTION");
7
8/// C FFI ABI version expected by downstream wrappers.
9pub const ABI_VERSION: u32 = 3;
10
11/// FFI supports ordered route-hop construction.
12pub const CAP_ROUTE_PATH_ORDERED_HOPS: u64 = 0x0000_0000_0000_0001;
13
14/// FFI supports the v1 native batch execution endpoint.
15pub const CAP_BATCH_EXECUTE_V1: u64 = 0x0000_0000_0000_0002;
16
17/// FFI supports diagnostics snapshot export as JSON.
18pub const CAP_DIAGNOSTICS_JSON: u64 = 0x0000_0000_0000_0004;
19
20/// FFI supports tag-group subscription endpoints.
21pub const CAP_TAG_GROUP_SUBSCRIPTIONS: u64 = 0x0000_0000_0000_0008;
22
23/// FFI exposes per-client last-error message retrieval (`eip_get_last_error`).
24pub const CAP_LAST_ERROR: u64 = 0x0000_0000_0000_0010;
25
26/// FFI exposes comprehensive schema refresh for live controller edits/downloads.
27pub const CAP_SCHEMA_REFRESH: u64 = 0x0000_0000_0000_0020;
28
29/// Capability bitmap for ABI v3.
30pub const CAPABILITIES: u64 = CAP_ROUTE_PATH_ORDERED_HOPS
31    | CAP_BATCH_EXECUTE_V1
32    | CAP_DIAGNOSTICS_JSON
33    | CAP_TAG_GROUP_SUBSCRIPTIONS
34    | CAP_LAST_ERROR
35    | CAP_SCHEMA_REFRESH;
36
37/// Major version number
38pub const MAJOR_VERSION: u32 = 1;
39
40/// Minor version number
41pub const MINOR_VERSION: u32 = 2;
42
43/// Patch version number
44pub const PATCH_VERSION: u32 = 1;
45
46/// Version string in format "v0.1.0"
47pub const VERSION_STRING: &str = concat!("v", env!("CARGO_PKG_VERSION"));
48
49// The VERGEN_* vars come from `build.rs`. They are absent when building without
50// a git checkout (e.g. a crates.io tarball), so use `option_env!` with a literal
51// fallback rather than `env!`, which would fail to compile when a var is unset.
52
53/// Build date and time
54pub const BUILD_DATE: &str = match option_env!("VERGEN_BUILD_TIMESTAMP") {
55    Some(v) => v,
56    None => "unknown",
57};
58
59/// Git commit hash
60pub const GIT_HASH: &str = match option_env!("VERGEN_GIT_SHA") {
61    Some(v) => v,
62    None => "unknown",
63};
64
65/// Git commit date
66pub const GIT_COMMIT_DATE: &str = match option_env!("VERGEN_GIT_COMMIT_TIMESTAMP") {
67    Some(v) => v,
68    None => "unknown",
69};
70
71/// Git branch
72pub const GIT_BRANCH: &str = match option_env!("VERGEN_GIT_BRANCH") {
73    Some(v) => v,
74    None => "unknown",
75};
76
77/// Get the library version as a string
78#[must_use]
79pub fn get_version() -> &'static str {
80    VERSION
81}
82
83/// Get the library name
84#[must_use]
85pub fn get_name() -> &'static str {
86    NAME
87}
88
89/// Get the library description
90#[must_use]
91pub fn get_description() -> &'static str {
92    DESCRIPTION
93}