# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.

[package]
name = "multitude"
version = "0.3.0"
description = "Fast and flexible arena allocator."
readme = "README.md"
keywords = ["arena", "memory", "allocator", "bump"]
categories = ["memory-management", "data-structures"]

edition = { workspace = true }
rust-version = { workspace = true }
authors = { workspace = true }
license = { workspace = true }
homepage = { workspace = true }
repository = "https://github.com/microsoft/oxidizer/tree/main/crates/multitude"

[package.metadata.cargo_check_external_types]
allowed_external_types = [
    "allocator_api2::*",
    "bytemuck::*",
    "bytesbuf::*",
    "ptr_meta::*",
    "ptr_meta_derive::*",
    "serde::*",
    "serde_core::*",
    "widestring::*",
    "zerocopy::*",
]

[package.metadata.docs.rs]
rustdoc-args = ["--cfg", "docsrs"]
all-features = true

[features]
default = ["std"]
std = []
serde = ["dep:serde"]
stats = []
dst = ["ptr_meta/derive"]
utf16 = ["dep:widestring"]
bytes = ["dep:bytes"]
bytemuck = ["dep:bytemuck", "dst"]
bytesbuf = ["dep:bytesbuf", "std"]
zerocopy = ["dep:zerocopy", "dst"]

[dependencies]
allocator-api2 = { workspace = true, features = ["alloc"] }
bytemuck = { workspace = true, features = ["derive"], optional = true }
bytes = { workspace = true, optional = true }
bytesbuf = { workspace = true, optional = true }
ptr_meta = { workspace = true }
serde = { workspace = true, optional = true }
widestring = { workspace = true, features = ["alloc"], optional = true }
zerocopy = { workspace = true, optional = true }

# Loom is only used under `--cfg loom` for the model-checked tests.
# `target.'cfg(loom)'` is matched by Cargo when `RUSTFLAGS="--cfg loom"` is set.
[target.'cfg(loom)'.dependencies]
loom = { workspace = true }

[dev-dependencies]
allocator-api2 = { workspace = true, features = ["alloc"] }
bolero = { workspace = true, features = ["std"] }
# `std` transitively enables `bolero-engine/any`, which is required
# because bolero-libfuzzer 0.13.0 references `bolero_engine::any::run`
# but does not itself activate that feature on `bolero-engine`.
bumpalo = { workspace = true, features = ["collections"] }
criterion = { workspace = true }
mutants = { workspace = true }
serde_json = { workspace = true }

[target.'cfg(loom)'.dev-dependencies]
loom = { workspace = true }

# Workspace dep declares `default-features = false`; we re-enable `default` here
# (which pulls in the `benchmark` feature with `library_benchmark`,
# `library_benchmark_group!`, and `gungraun::main!`) only on Linux.
[target.'cfg(target_os = "linux")'.dev-dependencies]
gungraun = { workspace = true, features = ["default"] }

[lints]
workspace = true

[[bench]]
name = "criterion_alloc"
harness = false

[[bench]]
name = "criterion_drop"
harness = false

# Callgrind benches require Linux (Valgrind). The bench files are gated to compile
# to a no-op on non-Linux targets, but the [[bench]] entry itself cannot be
# cfg-gated, so it is unconditional here.
[[bench]]
name = "gungraun_alloc"
harness = false

[[bench]]
name = "gungraun_drop"
harness = false

[[example]]
name = "multitude_basic"

[[example]]
name = "strings"