pub fn new<'a, L>(bucket_limit: L) -> Result<Self>
    where
        L: Into<Cow<'a, [f64]>>,
    {
        let bucket_limit = bucket_limit.into();

        ensure_argument!(!bucket_limit.is_empty(), "bucket_limit must be non-empty");

        let is_finite = bucket_limit.iter().all(|&val| val.is_finite());
        ensure_argument!(is_finite, "bucket_limit must contain finite numbers");

        let is_ordered =
            izip!(bucket_limit.as_ref(), &bucket_limit[1..]).all(|(&lhs, &rhs)| lhs < rhs);
        ensure_argument!(is_ordered, "bucket_limit must be monotonically ordered");

        let bucket_limit = bucket_limit.into_owned();

        Ok(Self {
            min: f64::MAX,
            max: f64::MIN,
            num: 0.0,
            sum: 0.0,
            sum_squares: 0.0,
            bucket: vec![0.0; bucket_limit.len()],
            bucket_limit,
        })
    }
/// Create a histogram with bucket limits.
///
/// The `bucket_limit` must be an ordered sequence of finite values.
/// Otherwise it returns an error. The range of each bucket is defined by
///
/// - i == 0:  [f64::MIN]..`limit[0]`
/// - i > 0:  `limit[i-1]`..`limit[i]`
Create a histogram with bucket limits.
The `bucket_limit` must be an ordered sequence of finite values.
Otherwise it returns an error. The range of each bucket is defined by


Create a histogram with bucket limits . The ` bucket_limit ` must be an ordered sequence of finite values . Otherwise it returns an error . The range of each bucket is defined by
pub fn new<'a, L>(bucket_limit: L) -> Result<Self>
    where
        L: Into<Cow<'a, [f64]>>,
    {
        let bucket_limit = bucket_limit.into();
        ensure_argument!(!bucket_limit.is_empty(), "bucket_limit must be non-empty");
        let is_finite = bucket_limit.iter().all(|&val| val.is_finite());
        ensure_argument!(is_finite, "bucket_limit must contain finite numbers");
        let is_ordered =
            izip!(bucket_limit.as_ref(), &bucket_limit[1..]).all(|(&lhs, &rhs)| lhs < rhs);
        ensure_argument!(is_ordered, "bucket_limit must be monotonically ordered");
        let bucket_limit = bucket_limit.into_owned();
        Ok(Self {
            min: f64::MAX,
            max: f64::MIN,
            num: 0.0,
            sum: 0.0,
            sum_squares: 0.0,
            bucket: vec![0.0; bucket_limit.len()],
            bucket_limit,
        })
    }
pub fn new < ' a , L > ( bucket_limit : L ) -> Result < Self > where L : Into < Cow < ' a , [ f64 ] > > , { let bucket_limit = bucket_limit . into ( ) ; ensure_argument ! ( bucket_limit is_empty ( ) " " ) ; let is_finite = bucket_limit . iter ( ) . all ( | & val | val . is_finite ( ) ) ; ensure_argument ! ( is_finite " " ) ; let is_ordered = izip ! ( bucket_limit as_ref ( ) bucket_limit [ 1 ] ) . all ( | ( & lhs , & rhs ) | lhs < rhs ) ; ensure_argument ! ( is_ordered " " ) ; let bucket_limit = bucket_limit . into_owned ( ) ; Ok ( Self { min : f64 :: MAX , max : f64 :: MIN , num : 0.0 , sum : 0.0 , sum_squares : 0.0 , bucket : vec ! [ 0.0 bucket_limit len ( ) ] , bucket_limit , } ) }
Create a histogram with bucket limits.
Create a histogram with bucket limits .
bucket_limit
L
bucket_limit
L