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
// https://github.com/rust-lang/rfcs/blob/master/text/2585-unsafe-block-in-unsafe-fn.md
#![deny(unsafe_op_in_unsafe_fn)]
// we do some static assertions to make sure C bindings are okay.
#![allow(clippy::assertions_on_constants)]

use vasi::VirtualAddressSpaceIndependent;

pub mod emulated_time;
pub mod explicit_drop;
pub mod ipc;
pub mod notnull;
pub mod option;
pub mod rootedcell;
pub mod shim_event;
pub mod shim_shmem;
pub mod simulation_time;
pub mod syscall_types;
pub mod util;

#[repr(transparent)]
#[derive(
    Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Copy, Clone, VirtualAddressSpaceIndependent,
)]
pub struct HostId(u32);

impl From<u32> for HostId {
    fn from(i: u32) -> Self {
        HostId(i)
    }
}

impl From<HostId> for u32 {
    fn from(i: HostId) -> Self {
        i.0
    }
}

// Force cargo to link against crates that aren't (yet) referenced from Rust
// code (but are referenced from this crate's C code).
// https://github.com/rust-lang/cargo/issues/9391
extern crate logger;
extern crate shadow_shmem;