v0.3.0
This commit is contained in:
parent
7db8e9c3ab
commit
7c73d32ffa
5 changed files with 32 additions and 44 deletions
|
|
@ -14,7 +14,7 @@
|
|||
//!
|
||||
//! In doc comments, _N_ represents the number of samples, _D_ represents the number of different values taken by the samples.
|
||||
|
||||
#![cfg_attr(feature = "nostd", no_std)]
|
||||
#![cfg_attr(not(feature = "std"), no_std)]
|
||||
|
||||
mod traits;
|
||||
|
||||
|
|
@ -34,7 +34,7 @@ pub struct MedianAcc<
|
|||
_t: core::marker::PhantomData<T>,
|
||||
}
|
||||
|
||||
#[cfg(not(feature = "nostd"))]
|
||||
#[cfg(feature = "std")]
|
||||
pub mod vec {
|
||||
pub type MedianAcc<T> = crate::MedianAcc<T, Vec<(T, u32)>>;
|
||||
}
|
||||
|
|
@ -213,6 +213,7 @@ mod tests {
|
|||
|
||||
use rand::Rng;
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
fn naive_median<T: Clone + Ord>(samples: &mut [T]) -> Option<MedianResult<T>> {
|
||||
if samples.is_empty() {
|
||||
None
|
||||
|
|
@ -232,6 +233,7 @@ mod tests {
|
|||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
#[test]
|
||||
fn correctness() {
|
||||
let mut rng = rand::thread_rng();
|
||||
|
|
@ -249,6 +251,7 @@ mod tests {
|
|||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "smallvec")]
|
||||
#[test]
|
||||
fn correctness_smallvec() {
|
||||
let mut rng = rand::thread_rng();
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ pub trait InsertIndex: cc_traits::Collection {
|
|||
) -> Self::Output;
|
||||
}
|
||||
|
||||
#[cfg(not(feature = "nostd"))]
|
||||
#[cfg(feature = "std")]
|
||||
impl<T> InsertIndex for Vec<T> {
|
||||
type Output = ();
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue