Skip to content

Instantly share code, notes, and snippets.

@DutchGhost
Last active November 24, 2020 13:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DutchGhost/a0fc0846a9c43fb3fc460df7d583e067 to your computer and use it in GitHub Desktop.
Save DutchGhost/a0fc0846a9c43fb3fc460df7d583e067 to your computer and use it in GitHub Desktop.
#![no_std]
//#![no_implicit_prelude]
#[cfg(feature = "alloc")]
extern crate alloc;
#[cfg(feature = "std")]
extern crate std;
mod alloc {
#[cfg(not(feature = "std"))]
extern crate alloc;
#[cfg(not(feature = "std"))]
pub use alloc::boxed::Box;
#[cfg(feature = "std")]
pub use std::boxed::Box;
}
use {
::core,
};
//#[macro_use]
pub mod debug {
#[macro_export]
macro_rules! dbg {
($($input:tt)*) => {{
#[cfg(all(debug_assertions, feature = "std"))]
{
::std::dbg!($($input)*)
}
#[cfg(not(debug_assertions))]
{
$($input)*
}
}}
}
#[macro_use]
pub use crate::dbg;
}
#[cfg_attr(docs_rs, doc(cfg(feature = "alloc")))]
fn swap<T>(a: &'_ mut T, b: &'_ mut T)
-> ()
where
T: Copy
{
::core::mem::swap(a, b)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment