#![warn(missing_docs)]
#![no_std]
#![feature(thread_local)]
extern crate alloc;
#[cfg(test)]
extern crate std;
#[macro_export]
macro_rules! thread_local {
() => {};
($(#[$attr:meta])* static $name:ident: $t:ty = $init:expr; $($rest:tt)*) => {
$(#[$attr])*
static $name: $crate::thread::LocalKey<$t> = {
#[thread_local]
static STORAGE: $crate::cell::UnsafeCell<::core::option::Option<$t>> =
$crate::cell::UnsafeCell::new(::core::option::Option::None);
fn __get() -> *const $t {
unsafe {
let ptr = STORAGE.get();
if (*ptr).is_none() {
*ptr = ::core::option::Option::Some($init);
}
(*ptr).as_ref().unwrap_unchecked() as *const _
}
}
$crate::thread::LocalKey::new(__get)
};
$crate::thread_local!($($rest)*);
};
}
pub mod abi;
pub mod collections;
pub mod env;
pub mod error;
pub mod ffi;
pub mod fs;
pub mod io;
pub mod path;
pub mod process;
pub mod rt;
pub mod signal;
pub mod sync;
pub mod thread;
pub mod time;
pub mod tty;
pub mod borrow {
pub use alloc::borrow::*;
}
pub mod boxed {
pub use alloc::boxed::*;
}
pub mod cell {
pub use core::cell::*;
}
pub mod future {
pub use core::future::*;
}
pub mod hint {
pub use core::hint::*;
}
pub mod ops {
pub use core::ops::*;
}
pub mod pin {
pub use core::pin::*;
}
pub mod ptr {
pub use core::ptr::*;
}
pub mod rc {
pub use alloc::rc::*;
}
pub mod string {
pub use alloc::string::*;
}
pub mod task {
pub use core::task::*;
}
pub mod vec {
pub use alloc::vec::*;
}
pub use error::{Error, Result};