mirror of
https://github.com/bspeice/qadapt
synced 2025-07-03 06:45:02 -04:00
Vendor in the spin crate for the time being
This commit is contained in:
14
src/lib.rs
14
src/lib.rs
@ -30,10 +30,22 @@
|
||||
//! ```rust,no_run
|
||||
//! use qadapt::no_alloc;
|
||||
//!
|
||||
//! // This function is fine, there are no allocations here
|
||||
//! #[no_alloc]
|
||||
//! fn do_math() -> u8 {
|
||||
//! 2 + 2
|
||||
//! }
|
||||
//!
|
||||
//! // This function will trigger a panic when called
|
||||
//! #[no_alloc]
|
||||
//! fn does_panic() -> Box<u32> {
|
||||
//! Box::new(5)
|
||||
//! }
|
||||
//!
|
||||
//! fn main() {
|
||||
//! do_math();
|
||||
//! does_panic();
|
||||
//! }
|
||||
//! ```
|
||||
//!
|
||||
//! 2. Evaluate expressions with the `assert_no_alloc!` macro
|
||||
@ -60,7 +72,7 @@ pub use qadapt_macro::*;
|
||||
use libc::c_void;
|
||||
use libc::free;
|
||||
use libc::malloc;
|
||||
use spin::RwLock;
|
||||
use qadapt_spin::RwLock;
|
||||
use std::alloc::GlobalAlloc;
|
||||
use std::alloc::Layout;
|
||||
use std::thread;
|
||||
|
Reference in New Issue
Block a user