hadris_common/
lib.rs

1//! Common types and functions used by Hadris
2
3#![no_std]
4
5#[cfg(feature = "alloc")]
6extern crate alloc;
7
8#[cfg(feature = "std")]
9extern crate std;
10
11/// Algorithms (requires std for CRC and random)
12#[cfg(feature = "std")]
13pub mod alg;
14/// Strings (requires alloc for String/Vec)
15#[cfg(feature = "alloc")]
16pub mod str;
17/// Types
18pub mod types;
19
20/// A generic boot sector that informs the user they are loading the image incorrectly.
21///
22/// This is generated using the code in the `boot_sector` directory. See the README for more information.
23/// Currently this is required to be maually compiled, and tested.
24/// TODO: Make this a build script that generates the binary, and verify with a static analysis tool.
25pub static BOOT_SECTOR_BIN: &[u8] = include_bytes!("boot_sector.bin");
26
27#[cfg(test)]
28mod tests {
29    use super::*;
30
31    static_assertions::const_assert!(BOOT_SECTOR_BIN.len() == 512);
32}