vmgs/
lib.rs

1// Copyright (c) Microsoft Corporation.
2// Licensed under the MIT License.
3
4//! Implementation of the VMGS file format.
5//!
6//! # Implementation Notes
7//!
8//! This particular implementation of the VMGS file format began life as a
9//! line-by-line port of the existing C++ VMGS code in Hyper-V. This kind of
10//! rote-porting was fairly common in the early days of the HvLite project (when
11//! folks were still getting a feel for Rust), though as time has gone on, most
12//! instances of rote-ported code have been refactored/rewritten to follow
13//! idiomatic Rust patterns.
14//!
15//! Unfortunately, the VMGS code is pretty complex, and giving it a proper "deep
16//! clean" would require a non-trivial amount of developer effort, which as is
17//! often the case - not particularly easy to come by.
18//!
19//! Sure, there's been lots of _incremental_ improvements to the code over the
20//! years, and the implementation is in _much_ better shape today than it was in
21//! its early days... but the code still has plenty of echoes from that initial
22//! C++ port, which really ought to get ironed out.
23
24mod encrypt;
25mod error;
26mod storage;
27mod vmgs_impl;
28
29pub use error::Error;
30pub use vmgs_format::EncryptionAlgorithm;
31pub use vmgs_format::FileId;
32pub use vmgs_impl::Vmgs;
33pub use vmgs_impl::VmgsFileInfo;
34#[cfg(feature = "save_restore")]
35pub use vmgs_impl::save_restore;
36
37/// VMGS helper functions
38pub mod vmgs_helpers {
39    pub use crate::vmgs_impl::get_active_header;
40    pub use crate::vmgs_impl::read_headers;
41    pub use crate::vmgs_impl::validate_header;
42}
43
44/// Expose the `VmgsLogger` trait
45pub mod logger;