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

sluggish-write

Copyright (C) 2026  Anonymous



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/>.

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

//! # `sluggish-write`
//!
//! ##  Project
//!
//! -   License: GNU Lesser General Public License, either version 3, or (at your option) any later version.
//! -   _This project follows [Semantic Versioning 2.0.0]_
//!
//! ##  Features
//!
//! This project provides some tools for testing.
//!
//! ## Notes
//!
//! -   Documentation is built with all features. Some of them are optional. If you see components from other crates, you can view source to see
//!     what features are required.
//!
//! -   Nightly Rust is only required for building documentation.
//!
//! [Semantic Versioning 2.0.0]: https://semver.org/spec/v2.0.0.html

#![warn(missing_docs)]
#![feature(variant_count)]
#![feature(doc_cfg)]

// ╔═════════════════╗
// ║   IDENTIFIERS   ║
// ╚═════════════════╝

macro_rules! code_name  { () => { "sluggish-write" }}
macro_rules! version    { () => { "0.1.1" }}

/// # Crate name
pub const NAME: &str = "sluggish-write";

/// # Crate code name
pub const CODE_NAME: &str = code_name!();

/// # ID of this crate
pub const ID: &str = "nS0fQGifHTjUr86KA_ioXB4z_t7EX5vs2DDb2cypq5stBCRfKR-3afMHXfiIRojAKdiw1qbTwZw1fE-L3rMFag";

/// # Crate version
pub const VERSION: &str = version!();

/// # Crate release date (year/month/day)
pub const RELEASE_DATE: (u16, u8, u8) = (2026, 6, 30);

/// # Tag, which can be used for logging...
pub const TAG: &str = concat!(code_name!(), "::9d2d1f40::", version!());

// ╔════════════════════╗
// ║   IMPLEMENTATION   ║
// ╚════════════════════╝

/// # Wrapper for format!(), which prefixes your optional message with: module_path!(), line!()
macro_rules! __ {
    ($($arg: tt)+) => {
        format!("[{module_path}-{line}] {msg}", module_path=module_path!(), line=line!(), msg=format!($($arg)+))
    };
    () => {
        __!("(internal error)")
    };
}

/// # Makes new std::io::Error
macro_rules! err {
    ($kind: path, $($arg: tt)+) => { std::io::Error::new($kind, __!($($arg)+)) };
    ($($arg: tt)+) => { err!(std::io::ErrorKind::Other, $($arg)+) };
    () => { std::io::Error::new(std::io::ErrorKind::Other, __!()) };
}

pub mod debts;
pub mod version_info;

mod big_buf;
mod random;
mod sluggish_read;
mod sluggish_write;

pub use self::{
    big_buf::*,
    sluggish_read::*,
    sluggish_write::*,
};

/// # Result type used in this crate
pub type Result<T> = core::result::Result<T, std::io::Error>;

#[test]
fn test_crate_version() {
    assert_eq!(VERSION, env!("CARGO_PKG_VERSION"));
}
