[package]
authors = ["Dilshod Tadjibaev (@antimora)"]
categories = []
description = "Core types and utilities shared across the Burn ecosystem."
documentation = "https://docs.rs/burn-std"
edition.workspace = true
keywords = []
license.workspace = true
name = "burn-std"
readme.workspace = true
repository = "https://github.com/tracel-ai/burn/tree/main/crates/burn-std"
version.workspace = true

[lints]
workspace = true

[features]
default = ["std", "cubecl-common/default"]
doc = ["default"]
std = ["cubecl-common/std", "num-traits/std", "rand/std"]
tracing = ["cubecl-common/tracing"]

network = ["dep:indicatif", "dep:reqwest", "dep:tokio"]

[dependencies]
ahash = { workspace = true }
hashbrown = { workspace = true }
bytemuck = { workspace = true, features = ["extern_crate_alloc"] }
derive-new = { workspace = true }
enumset = { workspace = true }
half = { workspace = true, features = ["bytemuck"] }
num-traits = { workspace = true }
rand = { workspace = true, default-features = false }
rand_distr = { workspace = true }
serde = { workspace = true }
smallvec = { workspace = true, features = ["serde"] }
spin = { workspace = true }
thiserror = { workspace = true }

cubecl-common = { workspace = true, default-features = false, features = [
    "serde",
    "shared-bytes",
] }
cubecl-zspace = { workspace = true, default-features = false }
# Enable extra-platforms for portable-atomic support on targets without native atomics (e.g., thumbv6m)
# This is needed because cubecl-common's shared-bytes feature pulls in bytes
bytes = { workspace = true }

# Network downloader
indicatif = { workspace = true, optional = true }
reqwest = { workspace = true, optional = true }
tokio = { workspace = true, optional = true }

[dev-dependencies]
dashmap = { workspace = true }
paste = { workspace = true }
rand = { workspace = true, features = ["thread_rng"] }
serde_json = { workspace = true, features = ["alloc"] }
serial_test = { workspace = true }
tempfile = { workspace = true }

# Enable extra-platforms for bytes on targets without native atomics (e.g., thumbv6m-none-eabi)
[target.'cfg(not(target_has_atomic = "ptr"))'.dependencies]
bytes = { workspace = true, features = ["extra-platforms"] }
portable-atomic-util = { workspace = true }

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