[package]
name          = "error-stack"
version       = "0.7.1"
authors       = { workspace = true }
edition       = "2021"
rust-version  = "1.83.0"
license       = "MIT OR Apache-2.0"
description   = "A context-aware error-handling library that supports arbitrary attached user data"
documentation = "https://docs.rs/error-stack"
repository    = "https://github.com/hashintel/hash/tree/main/libs/error-stack"
keywords      = ["error", "errorstack", "error-handling", "report", "no_std"]
categories    = ["rust-patterns", "no-std"]
exclude       = ["package.json", "macros", "experimental"]

[package.metadata.sync.turborepo]
extra-dependencies = [
    { name = "@rust/error-stack-macros", version = "workspace:*" },
]

[dependencies]
# Public workspace dependencies

# Public third-party dependencies
anyhow       = { version = ">=1.0.73", public = true, optional = true, default-features = false }
eyre         = { version = ">=0.6", public = true, optional = true, default-features = false }
futures-core = { version = ">=0.3", public = true, optional = true, default-features = false }
serde_core   = { version = ">=1", public = true, optional = true, default-features = false }

# Private workspace dependencies
pin-project-lite = { workspace = true, optional = true }

# Private third-party dependencies
spin          = { version = ">=0.9", optional = true, default-features = false, features = ['rwlock', 'once'] }
tracing       = { version = ">=0.1", optional = true, default-features = false }
tracing-error = { version = ">=0.2", optional = true, default-features = false }

[dev-dependencies]
ansi-to-html       = { workspace = true }
expect-test        = { workspace = true }
futures            = { workspace = true, default-features = false, features = ["executor"] }
futures-util       = { workspace = true }
glob               = { workspace = true }
insta              = { workspace = true, features = ["filters", "ron"] }
owo-colors         = { workspace = true }
regex              = { workspace = true }
serde              = { workspace = true, features = ["derive"] }
supports-color     = { workspace = true }
supports-unicode   = { workspace = true }
thiserror          = { workspace = true }
tracing            = { workspace = true, features = ["attributes"] }
tracing-subscriber = { workspace = true }
trybuild           = { workspace = true }

[build-dependencies]
rustc_version = { workspace = true }

[features]
default = ["std", "backtrace"]

std       = ["anyhow?/std"] # Enables support for `Error`
backtrace = ["std"]         # Enables automatic capturing of `Backtrace`s (requires Rust 1.65+)

tracing   = ["dep:tracing"]                         # Uses the `tracing` library if messages would be printed to the terminal
spantrace = ["dep:tracing-error", "tracing", "std"] # Enables automatic capturing of `SpanTrace`s
serde     = ["dep:serde_core"]                      # Enables serialization support
hooks     = ['dep:spin']                            # Enables hooks on `no-std` platforms using spin locks

anyhow = ["dep:anyhow"]      # Provides `into_report` to convert `anyhow::Error` to `Report`
eyre   = ["dep:eyre", "std"] # Provides `into_report` to convert `eyre::Report` to `Report`

futures = ["dep:futures-core", "dep:pin-project-lite"] # Provides support for `futures` types, such as stream.

unstable = [] # Enables unstable features that are not covered under any stability guarantees

[lints]
workspace = true

[package.metadata.docs.rs]
all-features = true
cargo-args   = ["-Z", "unstable-options", "-Z", "rustdoc-scrape-examples"]
targets      = ["x86_64-unknown-linux-gnu"]

[[example]]
name                = "demo"
required-features   = ["std"]
doc-scrape-examples = true

[[example]]
name                = "exit_code"
required-features   = ["std"]
doc-scrape-examples = true

[[example]]
name                = "parse_config"
required-features   = ["std"]
doc-scrape-examples = true

[[example]]
name                = "detect"
required-features   = ['std']
doc-scrape-examples = true

[[test]]
name = "common"
test = false

[package.metadata.cargo-shear]
# Used in doc-tests
ignored = ["thiserror", "owo-colors"]
