1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#![cfg_attr(not(any(test, doctest)), no_std)]
#![cfg_attr(feature = "json-core", doc = include_str!("../README.md"))]
#![cfg_attr(not(feature = "json-core"), doc = "miniconf")]
#![deny(rust_2018_compatibility)]
#![deny(rust_2018_idioms)]
#![warn(missing_docs)]
#![forbid(unsafe_code)]

#[cfg(feature = "derive")]
pub use miniconf_derive::*;
mod tree;
pub use tree::*;
mod array;
mod iter;
pub use iter::*;
mod option;
mod packed;
pub use packed::*;
mod key;
pub use key::*;
mod jsonpath;
pub use jsonpath::*;
mod error;
pub use error::*;

#[cfg(feature = "json-core")]
mod json_core;
#[cfg(feature = "json-core")]
pub use json_core::*;

#[cfg(feature = "postcard")]
mod postcard;
#[cfg(feature = "postcard")]
pub use crate::postcard::*;

// re-export for proc-macro
#[doc(hidden)]
pub use serde::{Deserialize, Deserializer, Serialize, Serializer};

/// Returns the number of digits required to format an integer less than `x`.
pub const fn digits<const BASE: usize>(x: usize) -> usize {
    let mut max = BASE;
    let mut digits = 1;

    while x > max {
        max *= BASE;
        digits += 1;
    }
    digits
}