Documentation
/*
==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--

Bi

Copyright (C) 2019, 2021-2022, 2024  Anonymous

There are several releases over multiple years,
they are listed as ranges, such as: "2021-2022".

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License
along with this program.  If not, see <https://www.gnu.org/licenses/>.

::--::--::--::--::--::--::--::--::--::--::--::--::--::--::--::--
*/

//! # Options

use core::time::Duration;

/// # Options for `Bi`
///
/// For examples, see [`Bi`][struct:Bi].
///
/// [struct:Bi]: struct.Bi.html
#[derive(Debug, Eq, PartialEq)]
pub struct Options {

    /// # Limit
    ///
    /// Total memory size which is allowed to be used.
    ///
    /// Default: 100 MiB.
    pub limit: usize,

    /// # Buffer size
    ///
    /// This is for reading data.
    ///
    /// Default: 64 KiB.
    pub buf_size: usize,

    /// # Wait time-out
    ///
    /// If internal buffer is full, [`Bi`][struct:Bi] will wait until there is more space. This time-out value is used to control maximum time
    /// for waiting.
    ///
    /// Default: 10 seconds.
    ///
    /// [struct:Bi]: struct.Bi.html
    pub wait_timeout: Duration,

}

impl Default for Options {

    fn default() -> Self {
        Self {
            limit: 1024 * 1024 * 100,
            buf_size: 1024 * 64,
            wait_timeout: Duration::from_secs(10),
        }
    }

}

#[test]
fn test_options() {
    assert_eq!(Options::default(), Options {
        limit: 100 * 1024 * 1024,
        buf_size: 64 * 1024,
        wait_timeout: Duration::from_millis(10_000),
    });
}