#![no_builtins]
#![feature(lang_items)]
#![cfg_attr(not(test), no_std)]
pub use serde;
pub use serde_bindgen_core_derive::binding;
pub use serde_json_core;
pub use serde_json_core::heapless;
#[inline]
fn safe_copy<T: Copy + Default, const N: usize>(src: &[T]) -> [T; N] {
let mut ret: [T; N] = [Default::default(); N];
if src.len() < N {
ret[..src.len()].copy_from_slice(&src[..src.len()]);
} else {
ret.copy_from_slice(&src[..N]);
}
ret
}
pub trait SafeCopy<Item, const N: usize> {
fn safe_copy(&self) -> [Item; N];
}
macro_rules! impl_safe_copy_for_slice {
($t:ty) => {
impl<const N: usize> SafeCopy<$t, N> for &[$t] {
#[inline]
fn safe_copy(&self) -> [$t; N] {
safe_copy(self)
}
}
};
}
impl_safe_copy_for_slice!(u8);
impl_safe_copy_for_slice!(i8);
impl<const N: usize> SafeCopy<u8, N> for &str {
#[inline]
fn safe_copy(&self) -> [u8; N] {
let mut ret = self.as_bytes().safe_copy();
if N > 0 {
ret[N - 1] = 0;
}
ret
}
}
#[cfg(not(feature = "testing"))]
#[cfg(not(feature = "full"))]
#[lang = "eh_personality"]
fn eh_personality() {}
#[cfg(not(feature = "testing"))]
#[cfg(not(feature = "full"))]
#[panic_handler]
fn panic(_info: &core::panic::PanicInfo) -> ! {
loop {}
}