# devela manifest
# ==============================================================================
# https://doc.rust-lang.org/cargo/reference/manifest.html
# https://doc.rust-lang.org/nightly/cargo/CHANGELOG.html
#
## Table of Contents
#
# * [workspace]
#   * [members]
#   * [package]
#
# * [lib]
#
# * [package]
#   - [metadata.docs.rs]
#
# * [features]
#   - Development       (__*)
#   - Environment       (std,alloc,no_std)
#   - Module            (all,code,data,geom,lang,media,num,org,phys,run,sys,text,ui,work)
#   - Safety            (safest,safe,unsafe,…)
#   - Capability        (_*)
#     - default         (_max,_maxest)
#     - docs            (_docs, _docs_[examples|min|nodep|max])
#     - code            (_unroll*)
#     - data            (_data*,_tuple*,_value*,…)
#     - num             (_num*)
#     - text            (_text*)
#   - Dependency        (dep_*)
#   - Workspace         (devela_*)
#
# * [workspace.dependencies]
# * [dependencies] (required|optional)
#   * [dev-dependencies]
#   * [build-dependencies]
#
# * [patch]
# * [profile.*]
# * [badges]
# * [workspace.lints]
#   * [lints.rust]
#   * [lints.rustdoc]
#   * [lints.clippy]
#   * [lints.rust.unexpected_cfgs]
#     - configuration                (nightly_*)
#     - reflection                   (*··)
#
# * [[bench]]           metrics
# * [[bin]]             programs
# * [[example]]         examples


[workspace]
# ==============================================================================
# https://doc.rust-lang.org/cargo/reference/workspaces.html
resolver = "3"

## Bottom-up hierarchical dependency flow of units of compilation (? = optional)
# ·------------------------------------------------------------------------------
#                                                           .-------------------.
# ┌╼devela_base_macros        : base proc macros, zero-deps | always available, |
# └╥╼devela_base_core         : base  core-dependent items  | primitive focused |
#  ╟─┴╼devela_base_alloc?     : base alloc-dependent items  | monomorphizations |
#  ╟──┴╼devela_base_std?╾───┐ : base   std-dependent items  | stable interfaces |
#  ╚═╗╼devela_macros?       │ : optional proc macros        | & infrastructures |
#    ║                      │                               ··------------------·
#    ╚═╦╼devela             │ : unified front, traits       | integration layer |
#      ║ ├╼build/main───────┤ : build, codegen, debug       | public interfaces |
#      ║ └╼devela_postbuild─┘ : post-build processing       | development tools |
#      ╏                                                    ·-------------------·
members = [ # In sync with ./build/main/environment.rs
	"crates/base/macros", "crates/base/core", "crates/base/alloc", "crates/base/std",
	"crates/macros",
	".", # ← root package
	# "build/post",
]

[workspace.package]
# Centralizes member-package metadata.
# ------------------------------------------------------------------------------
version = "0.25.0" # In sync with ./docs/changelog.md
rust-version = "1.93.0" # In sync with ./README.md && ./.github/workflows/check.yml
documentation = "https://docs.rs/devela/"
authors = ["José Luis Cruz <joseluis@andamira.net>"]
license = "MIT OR Apache-2.0"
edition = "2024"

[lib]
path = "src/index.rs"
bench = false

[package]
# ==============================================================================
name = "devela"
build = "build/main/mod.rs"
description = "A development layer of coherence."
readme = "docs/readme_crate.md"
rust-version.workspace = true
edition.workspace = true
version.workspace = true
documentation.workspace = true
authors.workspace = true
license.workspace = true
categories = ["development-tools", "rust-patterns", "no-std::no-alloc"]
keywords = ["dev", "helper", "library", "std", "extension"]
repository = "https://github.com/andamira/devela"
autoexamples = false
autobenches = false
autobins = false
publish = true
include = [
	"/Cargo.toml",
	## source code
	"/build/main/**/*.rs", "/build/main/**/*.md", "/build/main/dep_all",
	"/src/**/*.rs", "/src/**/*.md", "/src/**/*.html",
	## documentation
	"/docs/nightly.md", "/docs/vendored*.md", "/LICENSE*",
	## examples shown from /src/_doc
	"/examples/code/enumint.rs",
	"/examples/code/enumset.rs",
	"/examples/data/bitfield.rs",
	"/examples/data/id_seq.rs",
	"/examples/work/coro_manager.rs",
	## programs
]

[package.metadata.docs.rs]
# ==============================================================================
# https://docs.rs/about/metadata
# https://github.com/rust-lang/crates-build-env/blob/master/linux/packages.txt
# [maximum build limits](https://docs.rs/crate/devela/latest/builds)
no-default-features = true
features = ["_docs", "__publish"]
rustc-args = [
	"--cfg", "nightly",
	"-Ctarget-cpu=native",
]
rustdoc-args = [
	"-Ctarget-cpu=native",
	"--generate-link-to-definition",
	"--html-in-header", "./src/_doc/header.html",
	"--cfg", "nightly",
]
default-target = "x86_64-unknown-linux-gnu"
targets = [ ## +std:
	"aarch64-apple-darwin", "x86_64-pc-windows-msvc",
	# "armv7-unknown-linux-gnueabihf", "aarch64-unknown-linux-gnu",
	# "riscv32gc-unknown-linux-gnu", "riscv64gc-unknown-linux-gnu",
	# "wasm32-wasip1",
	## no_std:
	# "i686-unknown-uefi", "x86_64-unknown-none",
	# "thumbv7m-none-eabi", "aarch64-unknown-unknown"
	# "riscv32imac-unknown-none-elf", "riscv64imac-unknown-none-elf",
	"wasm32-unknown-unknown",
]


[features] # 160/300 (140 remaining), 105 visible, 55 hidden
# ==============================================================================
# https://doc.rust-lang.org/cargo/reference/features.html

# Features are grouped in the following categories:
# - Development      __*
# - Environment      alloc, [no_]std
# - Module           …
# - Safety           [un]safe_*, …
# - Capability       _*
# - Dependency       dep_*
#
# Sintax:
# - ["name"]: Visible public-facing features.
# - ["_name"]: Hidden extra capability features.
# - ["__name"]: Development & maintenance features.
#
# Notes:
# - Features are in sync with ./build/main/features.rs & ./src/_doc/features.md.
# - List and count features with `./tools/manifest.sh features`.


#* Development features *#
# ------------------------------------------------------------------------------

__dbg = [ # shows extra debugging information
	"devela_base_core/__dbg",
	"devela_base_alloc?/__dbg", "devela_base_std?/__dbg",
]
__std = [ # disables `no_std` in base crates for testing
	"std",
	"devela_base_core/__std",
	"devela_base_alloc?/__std",
]

# enabled when publishing to crates.io or building online docs (see /src/code/util/_doclink!)
__publish = [
	"devela_base_core/__publish",
	"devela_base_alloc?/__publish", "devela_base_std?/__publish", "devela_macros?/__publish",
]

__docs_internal = [ # enables documentation for internal items
	"devela_base_core/__docs_internal",
	"devela_base_alloc?/__docs_internal", "devela_base_std?/__docs_internal",
	"devela_macros?/__docs_internal",
]
__exclude_test = [] # excludes examples from being tested
__force_miri_dst = [] # inhibits disabling miri on several modules


#* Environment features *#
# ------------------------------------------------------------------------------

alloc = [ # enables `alloc` functionality
	"devela_base_alloc",
	"bytemuck?/extern_crate_alloc", "jiff?/alloc",
	"memchr?/alloc", "portable-atomic-util?/alloc",
	"serde?/alloc",
]
std = [ # disables `no_std` compatibility and enables `std` functionality
	"alloc", "devela_base_std/std",
	"atomic?/std", "bytemuck?/extern_crate_std", "jiff?/std", "log?/std",
	"memchr?/std", "portable-atomic-util?/std", "raw-cpuid?/std",
	"serde?/std", "simdutf8?/std", "wide?/std",
]
no_std = [] # enables functionality incompatible with or substitute of `std`


#* Module features *#
# ------------------------------------------------------------------------------
# They set compile flags named `*··` (two interpuncts), for reflection.
# For example, `num··` will be set if any num submodule feature is enabled.
#
# In sync with ./tools/check.rs::SUB_MODULES

all = [ # enables all the 13 modules (and their submodules)
	"code", "data", "geom", "lang", "media",
	"num", "org", "phys", "run", "sys",
	"text", "ui", "vita", "work",
]
code = []
data = ["hash"]
	# codec
		hash = [] # HashFnv, HashPengy
		# crypto = []
	# list = []
geom = ["fig"]
	# dir = []
	fig = ["devela_base_core/fig"]
	# space
lang = ["glsl", "js"]
	# hum = []
		# i18n = []
	# repr
	# prog
		# dsl = []
		# ffi = []
			glsl = []
			js = []
media = ["audio", "font", "visual"]
	audio = ["devela_base_core/audio"]
	# doc = []
	font = ["devela_base_core/font"]
	visual = ["color", "draw", "image"]
		color = ["devela_base_core/color", "devela_base_alloc?/color", "devela_base_std?/color"]
		draw = ["devela_base_core/draw"]
		image = ["devela_base_core/image"]
num = ["int", "lin", "rand"]
	# dom
		int = ["devela_base_core/int", "devela_base_alloc?/int"] # Int TEMP
		# real
			# float
	lin = [] # linear algebra
	# prob
		rand = ["devela_base_core/rand", "devela_base_alloc?/rand", "devela_base_std?/rand"]
	# symb = []
org = []
	#
phys = ["time", "unit", "wave"]
	time = []
	unit = []
	wave = [] # wavelets
run = []
sys = ["io", "mem", "term"]
	# arch
		# simd = ["fontdue?/simd"]
		# wasm = [] # ["ring?/wasm32_unknown_unknown_js"]
	# device
		# audio
		# display
			# cocoa = []
			# gdi = []
			x11 = [] #
		# midi = []
	# fs
	io = []
	mem = ["bit"]
		bit = [] # BitSize
	# os
		# browser
		linux = [] #
		term = ["devela_base_core/term"] # media::image::sixel
		windows = []
text = ["grapheme", "translit"]
	grapheme = ["devela_base_core/grapheme"]
	translit = ["devela_base_core/translit"]
vita = []
ui = ["event", "layout"]
	event = []
	layout = []
work = [
	"process", "sync", "thread",
	"bytemuck?/zeroable_atomics",
]
	process = []
	sync = []
	thread = []


#* Safety features *#
# ------------------------------------------------------------------------------
# They are prefixed with either `safe` or `unsafe`.
# Safe features are associated to *modules*, and unsafe features to *purposes*.
#
# Usage:
# 1. enable the desired `unsafe` feature.
# 2. don't enable the `safe` feature for that module.
#
# The `safest` feature forbids unsafe transitively in dependencies
# (except for Rust's `core`, `alloc` and `std`).
#
# In sync with ./build/main/features.rs::[UN]SAFE & ./src/index.rs::safety)

safest = ["safe"] # forbids all `unsafe` in the workspace and all unsafe dependencies.

safe = [ # forbids `unsafe` in specific modules (by default only in non-base crates).
	"devela_base_core/safe",
	"devela_base_alloc?/safe", "devela_base_std?/safe",
	"devela_macros?/safe",
	"safe_code", "safe_data", "safe_geom", "safe_lang", "safe_media", "safe_num", "safe_org",
	"safe_phys", "safe_run", "safe_sys", "safe_text", "safe_ui", "safe_vita", "safe_work",
] # List of safe thematic modules (orthogonal to unsafe purposes):
	# thematic [22]
	safe_build = ["devela_base_std?/safe_build"]
	safe_code = ["devela_base_core/safe_code"]
	safe_data = ["devela_base_core/safe_data"]
	safe_geom = []
	safe_lang = []
		# safe_prog
			# safe_ffi
				# safe_js
		# safe_repr
	safe_media = [ # "devela_base_core/safe_media",
		"safe_audio", "safe_color", "safe_draw", "safe_font", "safe_image",
		]
		safe_audio = ["devela_base_core/safe_audio"]
		safe_visual = ["safe_color", "safe_draw", "safe_image"]
			safe_color = ["devela_base_core/safe_color",
				"devela_base_alloc?/safe_color", "devela_base_std?/safe_color"]
			safe_draw = ["devela_base_core/safe_draw"]
			safe_font = ["devela_base_core/safe_font"]
			safe_image = ["devela_base_core/safe_image"]
	safe_num = []
	safe_org = []
	safe_phys = ["safe_time"]
		safe_time = []
	safe_run = ["devela_base_core/safe_run"]
	safe_sys = ["safe_io", "safe_mem", "devela_base_core/safe_sys"]
		safe_io = ["devela_base_core/safe_io"]
		safe_mem = ["devela_base_core/safe_mem"]
	safe_text = ["devela_base_core/safe_text"]
	safe_ui = []
	safe_vita = []
	safe_work = ["devela_base_core/safe_work"]
		# safe_async

unsafe = [ # enables all `unsafe` (as long as it isn't forbidden in that module)
	"devela_macros?/unsafe",
	"devela_base_core/unsafe", "devela_base_alloc?/unsafe", "devela_base_std?/unsafe",
	#
	"unsafe_array", "unsafe_ffi", "unsafe_hint", "unsafe_layout",
	"unsafe_niche", "unsafe_ptr", "unsafe_slice", "unsafe_str",
	"unsafe_sync", "unsafe_syscall", "unsafe_thread",
] # `unsafe··`	[11]

	# List of unsafe purposes (orthogonal to safe modules):

	unsafe_array   = [ # faster array initialization, UninitArray
		"devela_base_core/unsafe_array",
		# "devela_base_alloc?/unsafe_array", "devela_base_std?/unsafe_array",
		# "devela_macros?/unsafe_array",
	]
	# unsafe_async   = [] # MAYBE
	unsafe_ffi     = [ # unsafe foreign function calls (WASM, OS, external C)
		"devela_base_core/unsafe_ffi",
		# "devela_base_alloc?/unsafe_ffi", "devela_base_std?/unsafe_ffi",
		# "devela_macros?/unsafe_ffi",
	]
	unsafe_hint    = [ # arch instructions, unreachable_unchecked, unchecked arithmetic
		"devela_base_core/unsafe_hint",
		# "devela_base_alloc?/unsafe_hint", "devela_base_std?/unsafe_hint",
		# "devela_macros?/unsafe_hint",
	]
	unsafe_layout  = [ # MemPod, DSTs in the stack, AnyExt::downcast*, Mem::*
		"devela_base_core/unsafe_layout",
		# "devela_base_alloc?/unsafe_layout", "devela_base_std?/unsafe_layout",
		# "devela_macros?/unsafe_layout",
	]
	unsafe_niche   = [ # unchecked niche constructors
		"devela_base_core/unsafe_niche",
		# "devela_base_alloc?/unsafe_niche", "devela_base_std?/unsafe_niche",
		# "devela_macros?/unsafe_niche",
	]
	unsafe_ptr     = [ # Pinned, pop methods without Clone, Ptr::*
		"devela_base_core/unsafe_ptr",
		# "devela_base_alloc?/unsafe_ptr", "devela_base_std?/unsafe_ptr",
		# "devela_macros?/unsafe_ptr",
	]
	unsafe_slice   = [ # extra slice methods, avoid bound checks
		"devela_base_core/unsafe_slice",
		# "devela_base_alloc?/unsafe_slice", "devela_base_std?/unsafe_slice",
		# "devela_macros?/unsafe_slice",
	]
	unsafe_str     = [ # unchecked utf-8 char and &str conversions
		"devela_base_core/unsafe_str",
		# "devela_base_alloc?/unsafe_str", "devela_base_std?/unsafe_str",
		# "devela_macros?/unsafe_str",
	]
	unsafe_sync    = [ # SpinLock, Send and Sync impls
		"devela_base_core/unsafe_sync",
		# "devela_base_alloc?/unsafe_sync", "devela_base_std?/unsafe_sync",
		# "devela_macros?/unsafe_sync",
	]
	unsafe_syscall = [ # os syscalls
		"devela_base_core/unsafe_syscall",
		# "devela_base_alloc?/unsafe_syscall", "devela_base_std?/unsafe_syscall",
		# "devela_macros?/unsafe_syscall",
	]
	unsafe_thread  = [ # Logging::set_logger_racy, Env::{remove_var, set_var}
		"devela_base_core/unsafe_thread",
		# "devela_base_alloc?/unsafe_thread", "devela_base_std?/unsafe_thread",
		# "devela_macros?/unsafe_thread",
	]


#* Capability features *#
# ------------------------------------------------------------------------------
# Most of these features are prefixed with an underscore (_) to be semi-hidden.
# Enabling them enables extra implementations which increases compilation times.
#
# They set automatic compile flags named `_*··`, used for reflection.
# For example, `_stack··` will be set if any _stack* feature is enabled.
# Which is done in ./build/main/features.rs
#
# TOC
# - default
# - docs
# - code
# - data
# - num
# - text

# default = []
_max = ["_data_all"]
_maxest = ["_max", "_tuple_72", "_unroll_2048"]

#* _docs capabilities *#
# ----------------------
# WAIT [\href does not work in display mode](https://github.com/KaTeX/KaTeX/issues/3571)
# WAIT [support \SI and \si from siunitx](https://github.com/KaTeX/KaTeX/issues/817)
# WAIT [missing cross-crate docs](https://github.com/rust-lang/rust/issues/120927)
# WAIT [link to downstream crates](https://github.com/rust-lang/rust/issues/74481)
# WAIT [typeless canonical url](https://github.com/rust-lang/rust/issues/55160)
# WAIT [odd canonical path](https://github.com/rust-lang/rust/issues/124608)
# WAIT [doc(canonical)](https://github.com/rust-lang/rfcs/issues/3011)
# WAIT [doc(visible)](https://github.com/rust-lang/rust/issues/66528)

_docs_examples = [ # documents examples and generates example items
	"devela_base_core/_docs_examples",
	"devela_base_alloc?/_docs_examples",
	"devela_base_std?/_docs_examples",
]
_docs_min = [ # the minimum capabilities to document every item independent of alloc/std/unsafe
	"_docs_examples",
	# workspace
	"devela_base_core/_docs_min",
	"devela_macros",
	# modules:
	"all",
		# device
			"x11",
		# sys
			"linux",
	# data:
	"_destaque_u8", "_stack_u8", "_graph_u8", "_tuple", "_unroll", "_value64",
]
_docs_nodep = [ # +std +unsafe +__dbg
	"_docs_min", "std", "unsafe", "__dbg",
	"devela_base_core/_docs_nodep",
	"devela_base_alloc?/_docs_nodep", "devela_base_std?/_docs_nodep", "devela_macros?/_docs_nodep",
]
_docs = [ # +dep_all
	"_docs_nodep", "dep_all",
	"devela_base_core/_docs",
	"devela_base_core/_docs",
	"devela_base_alloc?/_docs", "devela_base_std?/_docs", "devela_macros?/_docs",
]
_docs_max = [ # +max +__docs_internal
	"_docs", "_max", "__docs_internal"
]

#* code capabilities *#
# ---------------------

# `unroll!` macro and maximum recursion supported
_unroll = [] # recursion 64
_unroll_128 = ["_unroll"]
_unroll_256 = ["_unroll_128"]
_unroll_512 = ["_unroll_256"]
_unroll_1024 = ["_unroll_512"]
_unroll_2048 = ["_unroll_1024"]

#* data capabilities *#
# ---------------------

_data_all = ["_collections_all", "_tuple", "_value_all"]

# `Destaque*`, `Graph*`, `Node*`, `Stack*`, `Tuple`:
_collections_all = [ "_destaque_all", "_graph_all", "_node_all", "_stack_all", "_tuple" ]
	_destaque_all = ["_destaque_u8", "_destaque_u16", "_destaque_u32", "_destaque_usize"]
		_destaque_u8 = []
		_destaque_u16 = []
		_destaque_u32 = []
		_destaque_usize = []
	_graph_all = ["_graph_u8", "_graph_u16", "_graph_u32", "_graph_usize"]
		_graph_u8 = ["_node_u8"]
		_graph_u16 = ["_node_u16"]
		_graph_u32 = ["_node_u32"]
		_graph_usize = ["_node_usize"]
	_node_all = ["_node_u8", "_node_u16", "_node_u32", "_node_usize"]
		_node_u8 = []
		_node_u16 = []
		_node_u32 = []
		_node_usize = []
	_stack_all = ["_stack_u8", "_stack_u16", "_stack_u32", "_stack_usize"]
		_stack_u8 = []
		_stack_u16 = []
		_stack_u32 = []
		_stack_usize = []

# `Tuple` trait and maximum arity supported (example relative compilation times)
_tuple = [] # arity 12 # time:  3.3s, codegen: 96K (for >=2nd compil.)
_tuple_24 = ["_tuple"]          # time:  4.0s, codegen: 279K
_tuple_36 = ["_tuple_24"]       # time:  4.6s, codegen: 561K
_tuple_48 = ["_tuple_36"]       # time:  6.3s, codegen: 942K
_tuple_72 = ["_tuple_48"]       # time: 10.3s, codegen: 2.0M

# `DataValue*, DataType*, DataRaw*`:
_value_all = [
	"_value8", "_value16", "_value32", "_value64",
	"_value128", "_value256", "_value512", "_value1024",
	]
	_value8 = []
	_value16 = []
	_value32 = []
	_value64 = []
	_value128 = []
	_value256 = []
	_value512 = []
	_value1024 = []


#* Dependency features (optional external dependencies) *#
# ------------------------------------------------------------------------------
# They are associated to optional dependencies and groups of modules.
# Enabling any of these will set the `dep··` reflection flag.
#
# Names are prefixed with `dep_`, and use underscores in place of dashes.
#
##Links
# - https://doc.rust-lang.org/edition-guide/rust-2024/cargo-remove-implicit-features.html

# In sync with ./build/main/dep_all & ./src/yard/_dep.rs
dep_all = [ # enables all 13 optional external dependencies:
	"dep_atomic", "dep_bytemuck",
	"dep_hashbrown", "dep_jiff",
	"dep_memchr",
	"dep_portable_atomic", "dep_portable_atomic_util",
	"dep_rand_core", "dep_raw_cpuid",
	"dep_safe_arch",
	"dep_serde", "dep_simdutf8",
	"dep_wide",
]

# groups of dependencies, environment and modules
work_deps  = ["work", "dep_atomic", "dep_portable_atomic"]

# individual dependencies features
dep_atomic = ["dep:atomic"]                                                       # work::sync
dep_bytemuck = ["dep:bytemuck", "safe_arch?/bytemuck"]                            # sys::mem
dep_hashbrown = ["dep:hashbrown", "alloc"]  									  # data::key
dep_jiff = ["dep:jiff", "alloc"]                                                  # phys::time
dep_log = ["dep:log"]                                                             # sys::log
dep_memchr = ["dep:memchr", "devela_base_core/dep_memchr"]                        # text:str
dep_portable_atomic = ["dep:portable-atomic"]                                     # work::sync
dep_portable_atomic_util = ["dep:portable-atomic-util",                           # work::sync
	"devela_base_alloc?/dep_portable_atomic_util"]
dep_rand_core = ["dep:rand_core", "devela_base_core/dep_rand_core"]               # num::rand
dep_raw_cpuid = ["dep:raw-cpuid"]                                                 # sys::arch
dep_safe_arch = ["dep:safe_arch"]                                                 # sys::arch
dep_serde = ["dep:serde", "portable-atomic?/serde", "wide?/serde"]  			  # data::codec::serde
dep_simdutf8 = ["dep:simdutf8", "devela_base_core/dep_simdutf8"]                  # text::str
dep_wide = ["dep:wide", "devela_base_core/dep_wide"]                              # num::grain::wide


#* Workspace features *#
# ------------------------------------------------------------------------------

[dependencies] # 18 (1 required, 17 optional)
# ==============================================================================
# https://doc.rust-lang.org/cargo/reference/specifying-dependencies.html
#
## notes
# - dependencies are sorted alfabetically, with links and comments.
# - use `./tools/manifest.sh dependencies` to see the numbers.
#
## when adding a new optional dependency
# 1. Update `dep_all` above and /build/main/dep_all.
# 2. Add a new entry below and in ./src/_deps.rs.

#* workspace internal libraries (2req + 3opt) *#
devela_base_core   = { workspace = true }
#
devela_base_alloc  = { workspace = true, optional = true }
devela_base_std    = { workspace = true, optional = true }
#
devela_macros      = { workspace = true, optional = true }

#* optional external dependencies (14opt) *#

atomic = { workspace = true, optional = true }
bytemuck = { workspace = true, optional = true }
hashbrown = { workspace = true, optional = true }
jiff = { workspace = true, optional = true }
log = { workspace = true, optional = true }
memchr = { workspace = true, optional = true }
portable-atomic = { workspace = true, optional = true }
portable-atomic-util = { workspace = true, optional = true }
rand_core = { workspace = true, optional = true }
raw-cpuid = { workspace = true, optional = true }
safe_arch = { workspace = true, optional = true }
serde = { workspace = true, optional = true }
simdutf8 = { workspace = true, optional = true }
wide = { workspace = true, optional = true }


[workspace.dependencies]
# Centralizes dependency declarations used by workspace members.
# ------------------------------------------------------------------------------
devela_base_macros = { version = "0.25.0", path = "./crates/base/macros" }
devela_base_core   = { version = "0.25.0", path = "./crates/base/core" }
devela_base_alloc  = { version = "0.25.0", path = "./crates/base/alloc" }
devela_base_std    = { version = "0.25.0", path = "./crates/base/std" }
devela_macros      = { version = "0.25.0", path = "./crates/macros" }
#devela_buildpost   = { version = "0.25.0", path = "./build/post" }

#* optional external dependencies *#

[workspace.dependencies.atomic] # https://crates.io/crates/atomic (unsafe)
version = "0.6.1" # ✗ https://github.com/Amanieu/atomic-rs/commits/master/
default-features = false # 4 https://docs.rs/crate/atomic/latest/features
features = ["fallback"]

[workspace.dependencies.bytemuck] # https://crates.io/crates/bytemuck (unsafe)
version = "1.25" # ✓ https://github.com/Lokathor/bytemuck/blob/main/changelog.md
default-features = false # 21 https://docs.rs/crate/bytemuck/latest/features
features = ["alloc_uninit", "align_offset", "min_const_generics", "must_cast",
	"zeroable_maybe_uninit"]

[workspace.dependencies.hashbrown] # https://crates.io/crates/hashbrown (unsafe)
version = "0.16" # ✓ https://github.com/rust-lang/hashbrown/blob/master/CHANGELOG.md
default-features = false # 14 https://docs.rs/crate/hashbrown/latest/features
features = ["default-hasher", "inline-more"]

[workspace.dependencies.jiff] # https://crates.io/crates/jiff (safe ± few & checked)
version = "0.2" # ✓ https://github.com/BurntSushi/jiff/blob/master/CHANGELOG.md
default-features = false # 10 https://docs.rs/crate/jiff/latest/features
# features = [""] # https://docs.rs/jiff/latest/jiff/#crate-features

[workspace.dependencies.log] # https://crates.io/crates/log (optional unsafe)
version = "0.4.29" # ✓ https://github.com/rust-lang/log/blob/master/CHANGELOG.md
default-features = false # 25 https://docs.rs/crate/log/latest/features
# features = ["kv"]

[workspace.dependencies.memchr] # https://crates.io/crates/memchr (unsafe)
version = "2.8" # ✗ https://github.com/BurntSushi/memchr/commits/master/
default-features = false # 9 https://docs.rs/crate/memchr/latest/features

[workspace.dependencies.portable-atomic] # https://crates.io/crates/portable-atomic (unsafe)
version = "1.13" # ✓ https://github.com/taiki-e/portable-atomic/blob/main/CHANGELOG.md
default-features = false # 11 https://docs.rs/crate/portable-atomic/latest/features
# https://docs.rs/portable-atomic/1.11.0/portable_atomic/#optional-features
features = ["fallback", "float"]
# feature-gated: serde, require-cas(maybe)

[workspace.dependencies.portable-atomic-util] # https://crates.io/crates/portable-atomic-util (unsafe)
version = "0.2.5" # ✓ https://github.com/taiki-e/portable-atomic/blob/main/portable-atomic-util/CHANGELOG.md
default-features = false # 3 https://docs.rs/crate/portable-atomic-util/latest/features

[workspace.dependencies.rand_core] # https://crates.io/crates/rand_core (safe)
version = "0.10" # ✓ https://github.com/rust-random/rand_core/blob/master/CHANGELOG.md
default-features = false # 3 https://docs.rs/crate/rand_core/latest/features

[workspace.dependencies.raw-cpuid] # https://crates.io/crates/raw-cpuid (unsafe)
version = "11.6" # ✓ https://github.com/gz/rust-cpuid/blob/master/CHANGELOG.md
default-features = false # 9 https://docs.rs/crate/raw-cpuid/latest/features

[workspace.dependencies.safe_arch] # https://crates.io/crates/safe_arch (unsafe)
version = "1.0" # ✗ https://github.com/Lokathor/safe_arch/commits/main/
default-features = false # 2 https://docs.rs/crate/safe_arch/latest/features

[workspace.dependencies.serde] # https://crates.io/crates/serde (unsafe)
version = "1.0" # ✗ https://github.com/serde-rs/serde/releases
default-features = false # 7 https://docs.rs/crate/serde/latest/features
# WAIT [Const generics support](https://github.com/serde-rs/serde/issues/1937)

[workspace.dependencies.simdutf8] # https://crates.io/crates/simdutf8 (unsafe)
version = "0.1" # ✓ https://github.com/rusticstuff/simdutf8/blob/main/CHANGELOG.md
default-features = false # 6 https://docs.rs/crate/simdutf8/latest/features
# features = [] # https://github.com/rusticstuff/simdutf8/blob/main/Cargo.toml
# WAIT: [const_methods](https://github.com/rusticstuff/simdutf8/pull/111) text::str::namespace

[workspace.dependencies.wide] # https://crates.io/crates/wide (unsafe)
version = "1.1" # ✓ https://github.com/Lokathor/wide/blob/main/changelog.md
default-features = false # 2 https://docs.rs/crate/wide/latest/features


[dev-dependencies]
# Used for examples, metrics and tests. They inherit from [dependencies].
# ------------------------------------------------------------------------------
# devela = { path = ".", features = ["all"] }

# criterion = "*"


[build-dependencies]
# Used for the main build script. They do NOT inherit from [dependencies].
# ------------------------------------------------------------------------------
# devela_base_core = { workspace = true }
# devela_base_std  = { workspace = true, optional = true } # MAYBE RECONSIDER


# patches
# ==============================================================================
# https://doc.rust-lang.org/cargo/reference/overriding-dependencies.html#the-patch-section

# [patch.crates-io]
# devela = { path = './' } # make devela also a dependency of itself


# profiles
# ==============================================================================
# https://doc.rust-lang.org/cargo/reference/profiles.html
# https://doc.rust-lang.org/stable/rustc/codegen-options/
# https://nnethercote.github.io/perf-book/build-configuration.html
# https://doc.rust-lang.org/stable/cargo/guide/build-performance.html

[profile.dev]
debug = "line-tables-only"
# codegen-backend = "cranelift"

[profile.dev.package."*"]
debug = false
# codegen-backend = "llvm"
# opt-level = 3

[profile.debugging]
inherits = "dev"
debug = true

[profile.dev-lto]
inherits = "dev"
lto = "thin" # false, thin, fat, off

[profile.release-lto]
inherits = "release"
lto = "thin"

[profile.bench]
opt-level = 3
debug = false
lto = true
codegen-units = 1

[profile.wasm]
inherits = "release"
# https://rustwasm.github.io/docs/book/reference/code-size.html
opt-level = "s"      # Optimize for size
lto = true           # Enable link-time optimizations
codegen-units = 1    # Improve optimization at the cost of compile time
panic = "abort"      # Reduce binary size (no unwinding)
strip = true         # Remove debug symbols for smaller binaries


[badges]
# ==============================================================================
maintenance = { status = "experimental" }


[workspace.lints]
# ==============================================================================
# https://doc.rust-lang.org/cargo/reference/manifest.html#the-lints-section
# WAIT: [override lints](https://github.com/rust-lang/cargo/issues/13157) (can't customize)
[lints]
workspace = true

[workspace.lints.rust]
# https://doc.rust-lang.org/stable/nightly-rustc/rustc_lint/builtin/index.html#constants
# ------------------------------------------------------------------------------
# https://doc.rust-lang.org/rustc/lints/listing/deny-by-default.html
# WAIT: [lazy_type_alias](https://github.com/rust-lang/rust/issues/112792)
type_alias_bounds = "deny" # detects bounds in type aliases
unsafe_op_in_unsafe_fn = "deny" # unsafe use inside unsafe fn without unsafe block
#
# https://doc.rust-lang.org/rustc/lints/listing/warn-by-default.html
missing_docs = "warn" # missing docs for public items
# missing_debug_implementations = "warn" # missing Debug impls for public items
#
# https://doc.rust-lang.org/rustc/lints/listing/allowed-by-default.html
stable_features = "allow" # a feature attribute that has since been made stable
unused_features = "allow" # unused crate-level features (1.96)
unknown_lints = "allow" # unrecognized lint attributes

[workspace.lints.rustdoc]
# https://doc.rust-lang.org/rustdoc/lints.html
# ------------------------------------------------------------------------------

# missing_crate_level_docs = "warn" # no documentation at the crate root (or any binary)
#
# broken_intra_doc_links = "allow" # NOTE: conditionally allowed in index.rs & other places
redundant_explicit_links = "allow" # (primitive aliases (char) need the explicit reference)

[workspace.lints.clippy]
# https://doc.rust-lang.org/clippy/lints.html
# https://rust-lang.github.io/rust-clippy/master/index.html
# https://github.com/rust-lang/rust-clippy/blob/master/CHANGELOG.md
# ------------------------------------------------------------------------------
# --- deny ---
#
## [pedantic]
enum_glob_use = "deny" # `use Enum::*`
## [style]
missing_safety_doc = "deny" # no `# Safety` section in public unsafe fns
#
# --- warn ---
#
all = { level = "warn", priority = -1 } # (the default set of clippy lints)
## [complexity]
map_unwrap_or = "warn" # usage of result|option.map(_).unwrap_or[_else](_)
## [pedantic]
bool_to_int_with_if = "warn" # using an if statement to convert a bool to an int
cloned_instead_of_copied = "warn" # usage of cloned() where copied() could be used
ignored_unit_patterns = "warn" # Checks for usage of _ in patterns of type ()
float_cmp = "warn" # (in-)equality comparisons on floating-point values
manual_let_else = "warn" # cases where let...else could be used
manual_string_new = "warn" # usage of "" to create a String
ptr_cast_constness = "warn" # as casts between raw pointers that change their constness
# NOTE: not compatible with the is! macro w/o being able to ignore it in an expr:
# WAIT: [stmt_expr_attributes](https://github.com/rust-lang/rust/issues/15701)
# redundant_else = "warn" // else blocks that can be removed without changing semantics
same_functions_in_if_condition = "warn" # consecutive ifs with the same function call
semicolon_if_nothing_returned = "warn" # expr returns () but it's not followed by ;
single_match_else = "warn" # 2 arms in match where an if let else will usually suffice
trivially_copy_pass_by_ref = "warn" # fns with ref args that could be passed by value
unnested_or_patterns = "warn" # unnested or-patterns, (Some(a)|Some(b) vs Some(a|b))
unreadable_literal = "warn" #  long integral or float does not contain underscores
## [restriction]
default_union_representation = "warn" # union declared without #[repr(C)]
# doc_paragraphs_missing_punctuation = "warn" # doc paragraphs not ending with punctuation
empty_structs_with_brackets = "warn" # structs without fields, with brackets
# if_then_some_else_none = "warn" # if-else that could be written using bool::then[_some]
float_cmp_const = "warn" # (in-)equality comparisons on const floating-point values
#
# --- allow ---
#
## [correctness]
approx_constant = "allow" # floating-point approximating constants (are more precise in crate)
## [style]
collapsible_if = "allow" # nested if statements
doc_lazy_continuation = "allow" # markdown lazy paragraph continuations
mixed_attributes_style = "allow" # items with mixed (inner/outer) attributes
module_inception = "allow" # modules with the same name as its parent
needless_doctest_main = "allow" # doctests with a main fn (imported from examples)
wrong_self_convention = "allow" # `is_` methods having an owned self
## [suspicious]
empty_docs = "allow" # empty documentation

[workspace.lints.rust.unexpected_cfgs]
# WAIT: [override lints](https://github.com/rust-lang/cargo/issues/13157) (move down to [lints])
# https://dev-doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html
# https://doc.rust-lang.org/nightly/rustc/check-cfg/cargo-specifics.html
# https://doc.rust-lang.org/rustc/check-cfg.html
# ------------------------------------------------------------------------------
level = "warn"
check-cfg = [ # Allowed configuration flags:
	# Defined if the library is compiled as the primary package (not a dependency).
	'cfg(cargo_primary_package)',
	#
	# Allows excluding tests from being run, more concisely:
	'cfg(__exclude_test)',
	#
	# Expect more pointer widths.
	'cfg(target_pointer_width, values("8", "128"))',
	# Expect more target vendors. In sync with ./src/sys/env/namespace.rs:
	'cfg(target_vendor, values("vex"))', # WAIT
	#
	# Arch flags
	"cfg(any_target_arch_linux)", # x86_64, x86, arm, aarch64, riscv32, riscv64
	"cfg(any_target_arch_riscv)", # riscv32, riscv64
	#
	# Nightly flags hierarchy (gating unstable functionality):
	# --------------------------------------------------------------------------
	# They are prefixed with `nightly_`.
	# Enabling any of these will set the `nightly··` reflection flag.
	# In sync with: ./src/index.rs, ./build/main/features.rs && ./docs/nightly.md.
	#
	## Links
	# - https://doc.rust-lang.org/unstable-book/library-features.html
	# - https://releases.rs/
	# - ./tools/release_dates.rs
	# - ./docs/nightly.md
	"cfg(nightly)", # [12] (in sync with ./build/main/features.rs::FLAGS_NIGHTLY & ./src/index.rs)
		#
		# Unstable nightly features without clear stabilization timeline
		"cfg(nightly_unstable)",
			# WAIT: [allocator_api](https://github.com/rust-lang/rust/issues/32838)
			# - https://reloaded-project.github.io/Reloaded-III/Research/Demystifying-Rust-Allocators.html
			# NOTE:dep features: "hashbrown?/nightly"]
			"cfg(nightly_allocator)", # allocator_api
			#
			# WAIT: [explicit_tail_calls](https://github.com/rust-lang/rust/issues/112788)
			"cfg(nightly_become)", # explicit_tail_calls WARN:incomplete_features (commented out in index.rs)
			#
			# WAIT: [autodiff](https://github.com/rust-lang/rust/issues/124509)
			# https://rust-lang.zulipchat.com/#narrow/channel/390790-wg-autodiff
			# "cfg(nightly_autodiff)", # autodiff FLAG_DISABLED:nightly_autodiff
			#
			# WAIT: [coroutines](https://github.com/rust-lang/rust/issues/43122)
			"cfg(nightly_coro)", # coroutines, coroutine_trait, iter_from_coroutine
			#
			# WAIT: [doc_cfg](https://github.com/rust-lang/rust/issues/43781)
			# LINK: https://github.com/rust-lang/rfcs/blob/master/text/3631-rustdoc-cfgs-handling.md
			# WAIT: [doc_notable_trait](https://github.com/rust-lang/rust/issues/45040)
			"cfg(nightly_doc)",
			#
			# WAIT: [f16_and_f128](https://github.com/rust-lang/rust/issues/116909)
			# WAIT: [re-export](https://github.com/rust-lang/rust/issues/116909#issuecomment-2595319840)
			# NOTE: dep features: ["bytemuck?/nightly_float"]
			"cfg(nightly_float)", # f16, f128
			#
			# WAIT: [portable_simd](https://github.com/rust-lang/rust/issues/86656)
			"cfg(nightly_simd)", # portable_simd
		#
		# nightly features expected to stabilize soon:
		"cfg(nightly_stable)",
			"cfg(nightly_stable_1_94)",
			"cfg(nightly_stable_1_95)",
			"cfg(nightly_stable_1_96)",
			"cfg(nightly_stable_later)",
	#
	# Auto-enabled reflection flags from ./build/main/features.rs (22)
	# --------------------------------------------------------------------------
	# general: (4)
	"cfg(unsafe··, safe··, nightly··, dep··)",
	# data: (5)
	'cfg(data··)',
	'cfg(_destaque··, _stack··)',
	'cfg(_graph··, _node··)',
	# geom: (1)
	'cfg(geom··)',
	# lang: (2)
	'cfg(lang··, ffi··)',
	# media: (1)
	'cfg(media··, visual··)',
	# num: (1)
	'cfg(num··)',
	# org: (1)
	'cfg(org··)',
	# phys: (1)
	'cfg(phys··)',
	# run: (1)
	'cfg(run··)',
	# sys: (2)
	'cfg(sys··, mem··)',
    # text: (1)
    'cfg(text··)',
	# ui: (1)
	'cfg(ui··)',
	# vita: (1)
	'cfg(vita··)',
	# work: (1)
	'cfg(work··)',
]


# metrics
# ==============================================================================
# cargo bench --profile bench --bench NAME

# [[bench]]
# name = "static_map"
# path = "metrics/static_map.rs"
# harness = false

[[bench]]
name = "char_utf8"
path = "metrics/char_utf8.rs"
harness = false
[[bench]]
name = "char_utf8_custom"
path = "metrics/char_utf8_custom.rs"
harness = false

# programs
# ==============================================================================
# To install a binary:
# cargo install --path . --bin NAME -F std

# num
# [[bin]]
# name = "xoro"
# path = "src/num/rand/xorshift/xoro.rs"
# required-features = ["std", "rand"]


# examples
# ==============================================================================
# https://docs.rs/open-editor/latest/scrape-examples-help.html

# code
[[example]]
name = "cargo_script"
path = "examples/code/cargo_script.rs"
required-features = ["__exclude_test"]
doc-scrape-examples = false
[[example]]
name = "enumint" # NOTE: in docs
path = "examples/code/enumint.rs"
required-features = ["devela_macros"]
[[example]]
name = "enumset" # NOTE: in docs
path = "examples/code/enumset.rs"

# data
[[example]]
name = "bitfield" # NOTE: in docs
path = "examples/data/bitfield.rs"
[[example]]
name = "id_pin"
path = "examples/data/id_pin.rs"
required-features = [] # optional: "alloc"
doc-scrape-examples = false
[[example]]
name = "id_seq" # NOTE: in docs
path = "examples/data/id_seq.rs"

# sys::os::term
[[example]]
name = "term_linux"
path = "examples/sys/term/linux.rs"
required-features = ["linux", "unsafe_syscall"]
doc-scrape-examples = false

# work
[[example]]
name = "coro_manager" # NOTE: in docs
path = "examples/work/coro_manager.rs"
required-features = ["alloc"]
