1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#![warn(clippy::all)]
#![warn(clippy::pedantic)]
#![allow(clippy::must_use_candidate)]
#![allow(clippy::module_name_repetitions)]
#![allow(clippy::similar_names)]
#![allow(clippy::missing_errors_doc)]
#![allow(clippy::map_err_ignore)]
#![allow(clippy::used_underscore_binding)]
#![allow(clippy::option_if_let_else)]
#![allow(
clippy::missing_panics_doc,
clippy::semicolon_if_nothing_returned,
clippy::let_underscore_drop,
clippy::branches_sharing_code
)]
use byteorder::{BigEndian, WriteBytesExt};
use lazy_static::lazy_static;
use semver::Version;
use uuid::Uuid;
use std::convert::TryInto;
pub mod chunker;
pub mod manifest;
pub mod prelude;
pub mod repository;
pub const VERSION: &str = env!("CARGO_PKG_VERSION");
#[cfg(not(tarpaulin_include))]
lazy_static! {
pub static ref VERSION_PIECES: [u16; 3] = {
let mut output = [0_u16; 3];
let version = Version::parse(VERSION).expect("Unable to parse version");
output[0] = version.major.try_into().expect("Major version too big");
output[1] = version.minor.try_into().expect("Minor version too big");
output[2] = version.patch.try_into().expect("Patch version too big");
output
};
pub static ref VERSION_BYTES: [u8; 6] = {
let mut output = [0_u8;6];
let items = VERSION_PIECES.iter();
assert!(items.len() == 3);
let mut wrt: &mut[u8] = &mut output;
for i in items {
wrt.write_u16::<BigEndian>(*i).unwrap();
}
output
};
pub static ref VERSION_STRUCT: Version = {
Version::parse(VERSION).expect("Unable to parse version")
};
pub static ref IMPLEMENTATION_UUID: Uuid =
Uuid::parse_str("bfd30b79-4687-404e-a84d-112383994b26").unwrap();
}