cairo_vm/
lib.rs

1//! # An implementation of the Cairo virtual machine
2//!
3//! ## Feature Flags
4//! - `std`: Enables usage of the [`std`] standard library. Enabled by default.
5//! - `test_utils`: Enables the following to help with tests (not enabled by default):
6//!    - [`Hooks`](crate::vm::hooks::Hooks) support for the [VirtualMachine](vm::vm_core::VirtualMachine);
7//!    - the `print_*` family of hints;
8//!    - the `skip_next_instruction()` hints;
9//!    - implementations of [`arbitrary::Arbitrary`](https://docs.rs/arbitrary/latest/arbitrary/) for some structs.
10//! - `cairo-1-hints`: Enable hints that were introduced in Cairo 1. Not enabled by default.
11//! - `cairo-0-secp-hints`: Enable secp hints that were introduced in Cairo 0. Not enabled by default.
12//! - `cairo-0-data-availability-hints`: Enable data availability hints that were introduced in Cairo 0. Not enabled by default.
13
14#![cfg_attr(docsrs, feature(doc_cfg))]
15#![deny(warnings)]
16#![forbid(unsafe_code)]
17#![cfg_attr(any(target_arch = "wasm32", not(feature = "std")), no_std)]
18
19#[cfg(feature = "std")]
20include!("./with_std.rs");
21#[cfg(not(feature = "std"))]
22include!("./without_std.rs");
23
24pub mod stdlib {
25    pub mod collections {
26        #[cfg(feature = "std")]
27        pub use crate::with_std::collections::*;
28        #[cfg(not(feature = "std"))]
29        pub use crate::without_std::collections::*;
30    }
31
32    pub mod borrow {
33        #[cfg(feature = "std")]
34        pub use crate::with_std::borrow::*;
35        #[cfg(not(feature = "std"))]
36        pub use crate::without_std::borrow::*;
37    }
38
39    pub mod prelude {
40        pub use crate::stdlib::{
41            borrow::ToOwned,
42            boxed::Box,
43            clone::Clone,
44            cmp::{Eq, PartialEq, Reverse},
45            iter::IntoIterator,
46            string::{String, ToString},
47            vec::Vec,
48        };
49    }
50
51    #[cfg(feature = "std")]
52    pub use crate::with_std::*;
53    #[cfg(not(feature = "std"))]
54    pub use crate::without_std::*;
55}
56
57pub mod air_private_input;
58pub mod air_public_input;
59pub mod cairo_run;
60pub mod hint_processor;
61pub mod math_utils;
62pub mod program_hash;
63pub mod serde;
64pub mod typed_operations;
65pub mod types;
66pub mod utils;
67pub mod vm;
68
69// TODO: use `Felt` directly
70pub use starknet_types_core::felt::Felt as Felt252;
71
72#[cfg(test)]
73mod tests;