#![cfg_attr(not(feature = "std"), no_std)]
#![cfg_attr(feature = "std",
doc = "Substrate runtime standard library as compiled when linked with Rust's standard library.")]
#![cfg_attr(not(feature = "std"),
doc = "Substrate's runtime standard library as compiled without Rust's standard library.")]
#[macro_export]
macro_rules! map {
($( $name:expr => $value:expr ),*) => (
vec![ $( ( $name, $value ) ),* ].into_iter().collect()
)
}
#[cfg(feature = "std")]
#[macro_export]
macro_rules! if_std {
( $( $code:tt )* ) => {
$( $code )*
}
}
#[cfg(not(feature = "std"))]
#[macro_export]
macro_rules! if_std {
( $( $code:tt )* ) => {}
}
#[cfg(feature = "std")]
include!("../with_std.rs");
#[cfg(not(feature = "std"))]
include!("../without_std.rs");
#[derive(Default)]
pub struct Writer(vec::Vec<u8>);
impl fmt::Write for Writer {
fn write_str(&mut self, s: &str) -> fmt::Result {
self.0.extend(s.as_bytes());
Ok(())
}
}
impl Writer {
pub fn inner(&self) -> &vec::Vec<u8> {
&self.0
}
pub fn into_inner(self) -> vec::Vec<u8> {
self.0
}
}
pub mod prelude {
pub use crate::vec::Vec;
pub use crate::boxed::Box;
pub use crate::cmp::{Eq, PartialEq, Reverse};
pub use crate::clone::Clone;
#[cfg(not(feature = "std"))]
pub use crate::vec;
}