#[cfg(feature = "std")]
mod std {
pub type Box = ::std::boxed::Box;
pub type Map = ::std::collections::HashMap;
pub type Vec = ::std::vec::Vec;
pub type ChildrenVec = ::std::vec::Vec;
pub type ParentsVec = ::std::vec::Vec;
pub fn new_map_with_capacity(capacity: usize) -> Map
where
K: Eq + ::std::hash::Hash,
{
Map::with_capacity(capacity)
}
pub fn new_vec_with_capacity(capacity: usize) -> Vec {
Vec::with_capacity(capacity)
}
#[inline]
pub fn round(value: f32) -> f32 {
value.round()
}
#[inline]
pub fn abs(value: f32) -> f32 {
value.abs()
}
}
#[cfg(feature = "alloc")]
mod alloc {
pub type Box = ::alloc::boxed::Box;
pub type Map = ::hashbrown::HashMap;
pub type Vec = ::alloc::vec::Vec;
pub type ChildrenVec = ::alloc::vec::Vec;
pub type ParentsVec = ::alloc::vec::Vec;
pub fn new_map_with_capacity(capacity: usize) -> Map {
Map::with_capacity(capacity)
}
pub fn new_vec_with_capacity(capacity: usize) -> Vec {
Vec::with_capacity(capacity)
}
#[inline]
pub fn round(value: f32) -> f32 {
num_traits::float::FloatCore::round(value)
}
#[inline]
pub fn abs(value: f32) -> f32 {
num_traits::float::FloatCore::abs(value)
}
}
#[cfg(all(not(feature = "alloc"), not(feature = "std")))]
mod core {
use typenum::marker_traits::Unsigned;
type MaxNodeCount = heapless::consts::U256;
type MaxChildCount = heapless::consts::U16;
type MaxParentsCount = heapless::consts::U1;
pub type Map = ::heapless::FnvIndexMap;
pub type Vec = ::arrayvec::ArrayVec<[A; MaxNodeCount::USIZE]>;
pub type ChildrenVec = ::arrayvec::ArrayVec<[A; MaxChildCount::USIZE]>;
pub type ParentsVec = ::arrayvec::ArrayVec<[A; MaxParentsCount::USIZE]>;
pub fn new_map_with_capacity(_capacity: usize) -> Map
where
K: Eq + ::hash32::Hash,
{
Map::new()
}
pub fn new_vec_with_capacity(_capacity: usize) -> ::arrayvec::ArrayVec
where
A: ::arrayvec::Array- ,
{
::arrayvec::ArrayVec::new()
}
#[inline]
pub fn round(value: f32) -> f32 {
num_traits::float::FloatCore::round(value)
}
#[inline]
pub fn abs(value: f32) -> f32 {
num_traits::float::FloatCore::abs(value)
}
}
#[cfg(feature = "alloc")]
pub use self::alloc::*;
#[cfg(all(not(feature = "alloc"), not(feature = "std")))]
pub use self::core::*;
#[cfg(feature = "std")]
pub use self::std::*;