shadow_rs/
lib.rs

1//! The Shadow network simulator.
2//!
3//! Shadow is a discrete-event network simulator that directly executes real application code,
4//! enabling you to simulate distributed systems with thousands of network-connected processes in
5//! realistic and scalable private network experiments using your laptop, desktop, or server running
6//! Linux.
7
8// https://github.com/rust-lang/rfcs/blob/master/text/2585-unsafe-block-in-unsafe-fn.md
9#![deny(unsafe_op_in_unsafe_fn)]
10#![allow(clippy::not_unsafe_ptr_arg_deref)]
11#![allow(clippy::enum_variant_names)]
12#![allow(clippy::too_many_arguments)]
13
14// we make all of the modules public so that rustdoc will generate documentation for them, even
15// though it doesn't really make sense for them to be public
16
17// this must be exactly "cbindgen:ignore"; you cannot add any other text to the doc string
18/// cbindgen:ignore
19pub mod cshadow {
20    #![allow(non_upper_case_globals)]
21    #![allow(non_camel_case_types)]
22    #![allow(non_snake_case)]
23    // https://github.com/rust-lang/rust/issues/66220
24    #![allow(improper_ctypes)]
25    #![allow(unsafe_op_in_unsafe_fn)]
26    #![allow(clippy::all)]
27    include!(concat!(env!("OUT_DIR"), "/cshadow.rs"));
28}
29
30// modules with macros must be included before other modules
31#[macro_use]
32pub mod utility;
33
34pub mod core;
35pub mod host;
36pub mod network;
37pub mod shadow;
38
39// Force cargo to link against crates that aren't (yet) referenced from Rust
40// code (but are referenced from this crate's C code).
41// https://github.com/rust-lang/cargo/issues/9391
42extern crate shadow_shmem;
43extern crate shadow_tsc;
44
45// shadow re-exports this definition from /usr/include/linux/tcp.h
46// TODO: Provide this via the linux-api crate instead.
47unsafe impl shadow_pod::Pod for crate::cshadow::tcp_info {}
48
49// check that the size and alignment of `CompatUntypedForeignPtr` and `ForeignPtr<()>` are the same`
50static_assertions::assert_eq_size!(
51    cshadow::CompatUntypedForeignPtr,
52    shadow_shim_helper_rs::syscall_types::UntypedForeignPtr,
53);
54static_assertions::assert_eq_align!(
55    cshadow::CompatUntypedForeignPtr,
56    shadow_shim_helper_rs::syscall_types::UntypedForeignPtr,
57);