valence/crates/valence_core/Cargo.toml
Ryan Johnson 6338fc6300
serde support for valence_nbt + fixes. (#352)
## Description

- Reorganize `valence_nbt` and feature flag the different parts. SNBT
and binary serialization are each behind their own flags.
- Add optional serde support to `valence_nbt` behind the `serde` flag.
This is useful for end users working with `valence_nbt` and allows us to
simplify some code in `valence_biome` and `valence_dimension`.

Note that this includes a `Serializer` and `Deserializer` for `Compound`
and _not_ the binary and SNBT formats. In other words, it's not possible
to go directly from an arbitrary data format to binary NBT and vice
versa, but it _is_ possible to go to and from `Compound` and finish the
(de)serialization this way. I consider this an acceptable compromise
because writing fast and correct serialization routines for `Compound`
becomes more difficult when serde is in the way. Besides, the
intermediate `Compound` often needs to be created anyway.
- Fixed unsound uses of `std::mem::transmute` in `valence_nbt` and
elsewhere. Using `transmute` to cast between slice types is unsound
because slices are `#[repr(Rust)]` and the layouts are not guaranteed.
`slice::from_raw_parts` is used as the replacement.
2023-06-04 05:56:10 -07:00

45 lines
1.2 KiB
TOML

[package]
name = "valence_core"
version.workspace = true
edition.workspace = true
build = "build/main.rs"
[features]
encryption = ["dep:aes", "dep:cfb8"]
compression = ["dep:flate2"]
[dependencies]
aes = { workspace = true, optional = true }
anyhow.workspace = true
bevy_app.workspace = true
bevy_ecs.workspace = true
bitfield-struct.workspace = true
byteorder.workspace = true
bytes.workspace = true
cfb8 = { workspace = true, optional = true }
flate2 = { workspace = true, optional = true }
glam.workspace = true
serde = { workspace = true, features = ["derive"] }
serde_json.workspace = true
thiserror.workspace = true
tracing.workspace = true
uuid = { workspace = true, features = ["serde"] }
valence_nbt = { workspace = true, features = ["binary"] }
valence_core_macros.workspace = true
url.workspace = true
base64.workspace = true
rand.workspace = true
[dev-dependencies]
rand.workspace = true
valence_core = { workspace = true, features = ["compression"] }
[build-dependencies]
anyhow.workspace = true
heck.workspace = true
proc-macro2.workspace = true
quote.workspace = true
serde = { workspace = true, features = ["derive"] }
serde_json.workspace = true
valence_build_utils.workspace = true