[package]
edition = "2024"
rust-version = "1.85"
name = "bitsandbytes"
version = "0.3.2"
build = false
autolib = false
autobins = false
autoexamples = false
autotests = false
autobenches = false
description = "An owned, bit-aware binary codec: fast bit/byte field types and the unified #[bin] macro."
readme = "README.md"
keywords = [
"bitfield",
"codec",
"binary",
"no_std",
"protocol",
]
categories = [
"encoding",
"parsing",
"no-std",
"network-programming",
]
license = "MIT OR Apache-2.0"
repository = "https://github.com/RawSocketLabs/rsl"
resolver = "2"
[package.metadata.docs.rs]
all-features = true
rustdoc-args = [
"--cfg",
"docsrs",
]
[features]
bytes = [
"dep:bytes",
"std",
]
default = ["std"]
mock = ["net"]
net = ["std"]
std = ["dep:tracing"]
tokio = [
"dep:tokio-util",
"bytes",
]
[lib]
name = "bnb"
path = "src/lib.rs"
[[example]]
name = "ais"
path = "examples/ais.rs"
[[example]]
name = "alignment"
path = "examples/alignment.rs"
[[example]]
name = "arbitrary_width"
path = "examples/arbitrary_width.rs"
[[example]]
name = "archive"
path = "examples/archive.rs"
[[example]]
name = "bin_message"
path = "examples/bin_message.rs"
[[example]]
name = "bitbuf"
path = "examples/bitbuf.rs"
[[example]]
name = "bitbuf_bounded"
path = "examples/bitbuf_bounded.rs"
[[example]]
name = "bitfield_bytes"
path = "examples/bitfield_bytes.rs"
[[example]]
name = "bufsource"
path = "examples/bufsource.rs"
[[example]]
name = "bytes_frame"
path = "examples/bytes_frame.rs"
required-features = ["bytes"]
[[example]]
name = "can_signals"
path = "examples/can_signals.rs"
[[example]]
name = "checked"
path = "examples/checked.rs"
[[example]]
name = "conditional"
path = "examples/conditional.rs"
[[example]]
name = "cstring"
path = "examples/cstring.rs"
[[example]]
name = "ctx"
path = "examples/ctx.rs"
[[example]]
name = "ctx_length"
path = "examples/ctx_length.rs"
[[example]]
name = "dns"
path = "examples/dns.rs"
[[example]]
name = "endianness"
path = "examples/endianness.rs"
[[example]]
name = "enums"
path = "examples/enums.rs"
[[example]]
name = "flags"
path = "examples/flags.rs"
[[example]]
name = "framed"
path = "examples/framed.rs"
required-features = ["bytes"]
[[example]]
name = "heartbeat"
path = "examples/heartbeat.rs"
[[example]]
name = "ipv4"
path = "examples/ipv4.rs"
[[example]]
name = "mock_datagram"
path = "examples/mock_datagram.rs"
required-features = ["mock"]
[[example]]
name = "mock_stream"
path = "examples/mock_stream.rs"
required-features = ["mock"]
[[example]]
name = "padding"
path = "examples/padding.rs"
[[example]]
name = "peek"
path = "examples/peek.rs"
[[example]]
name = "register"
path = "examples/register.rs"
[[example]]
name = "reserved"
path = "examples/reserved.rs"
[[example]]
name = "sockets"
path = "examples/sockets.rs"
required-features = ["net"]
[[example]]
name = "standalone"
path = "examples/standalone.rs"
[[example]]
name = "streaming"
path = "examples/streaming.rs"
[[example]]
name = "tcp"
path = "examples/tcp.rs"
[[example]]
name = "telemetry"
path = "examples/telemetry.rs"
[[example]]
name = "tlv"
path = "examples/tlv.rs"
[[example]]
name = "tokio_framed"
path = "examples/tokio_framed.rs"
required-features = ["tokio"]
[[example]]
name = "tokio_udp"
path = "examples/tokio_udp.rs"
required-features = ["tokio"]
[[example]]
name = "try_str"
path = "examples/try_str.rs"
[[example]]
name = "unix_stream"
path = "examples/unix_stream.rs"
required-features = ["net"]
[[example]]
name = "validate"
path = "examples/validate.rs"
[[example]]
name = "varint"
path = "examples/varint.rs"
[[example]]
name = "versioned"
path = "examples/versioned.rs"
[[example]]
name = "versioned_cells"
path = "examples/versioned_cells.rs"
[[example]]
name = "wav"
path = "examples/wav.rs"
[[example]]
name = "wire_map"
path = "examples/wire_map.rs"
[[example]]
name = "wire_map_dynamic"
path = "examples/wire_map_dynamic.rs"
[[test]]
name = "bin_assert"
path = "tests/bin_assert.rs"
[[test]]
name = "bin_byte_order"
path = "tests/bin_byte_order.rs"
[[test]]
name = "bin_calc_temp"
path = "tests/bin_calc_temp.rs"
[[test]]
name = "bin_canonical"
path = "tests/bin_canonical.rs"
[[test]]
name = "bin_codec_newtype"
path = "tests/bin_codec_newtype.rs"
[[test]]
name = "bin_count"
path = "tests/bin_count.rs"
[[test]]
name = "bin_count_adversarial"
path = "tests/bin_count_adversarial.rs"
[[test]]
name = "bin_count_prefix"
path = "tests/bin_count_prefix.rs"
[[test]]
name = "bin_ctx"
path = "tests/bin_ctx.rs"
[[test]]
name = "bin_ctx_docs"
path = "tests/bin_ctx_docs.rs"
[[test]]
name = "bin_ctx_layer2"
path = "tests/bin_ctx_layer2.rs"
[[test]]
name = "bin_enum"
path = "tests/bin_enum.rs"
[[test]]
name = "bin_fold"
path = "tests/bin_fold.rs"
[[test]]
name = "bin_if"
path = "tests/bin_if.rs"
[[test]]
name = "bin_ignore"
path = "tests/bin_ignore.rs"
[[test]]
name = "bin_lsb_dbc"
path = "tests/bin_lsb_dbc.rs"
[[test]]
name = "bin_macro"
path = "tests/bin_macro.rs"
[[test]]
name = "bin_magic"
path = "tests/bin_magic.rs"
[[test]]
name = "bin_map"
path = "tests/bin_map.rs"
[[test]]
name = "bin_net_addr"
path = "tests/bin_net_addr.rs"
[[test]]
name = "bin_order_matrix"
path = "tests/bin_order_matrix.rs"
[[test]]
name = "bin_parse_with"
path = "tests/bin_parse_with.rs"
[[test]]
name = "bin_phase2"
path = "tests/bin_phase2.rs"
[[test]]
name = "bin_positioning"
path = "tests/bin_positioning.rs"
[[test]]
name = "bin_reserved"
path = "tests/bin_reserved.rs"
[[test]]
name = "bin_restore_position"
path = "tests/bin_restore_position.rs"
[[test]]
name = "bin_scratch"
path = "tests/bin_scratch.rs"
[[test]]
name = "bin_seek"
path = "tests/bin_seek.rs"
[[test]]
name = "bin_try_str"
path = "tests/bin_try_str.rs"
[[test]]
name = "bin_validate"
path = "tests/bin_validate.rs"
[[test]]
name = "bin_wire_len"
path = "tests/bin_wire_len.rs"
[[test]]
name = "bin_wire_map"
path = "tests/bin_wire_map.rs"
[[test]]
name = "bitfield_byte_order"
path = "tests/bitfield_byte_order.rs"
[[test]]
name = "bitfield_debug"
path = "tests/bitfield_debug.rs"
[[test]]
name = "bitfield_view"
path = "tests/bitfield_view.rs"
[[test]]
name = "bitstream_bitorder"
path = "tests/bitstream_bitorder.rs"
[[test]]
name = "bitstream_builder"
path = "tests/bitstream_builder.rs"
[[test]]
name = "bitstream_dmr"
path = "tests/bitstream_dmr.rs"
[[test]]
name = "bitstream_dmr_frame"
path = "tests/bitstream_dmr_frame.rs"
[[test]]
name = "bitstream_guard"
path = "tests/bitstream_guard.rs"
[[test]]
name = "bitstream_nested"
path = "tests/bitstream_nested.rs"
[[test]]
name = "bitstream_payload"
path = "tests/bitstream_payload.rs"
[[test]]
name = "builder"
path = "tests/builder.rs"
[[test]]
name = "codec_tokio"
path = "tests/codec_tokio.rs"
[[test]]
name = "compile_fail"
path = "tests/compile_fail.rs"
[[test]]
name = "comprehensive"
path = "tests/comprehensive.rs"
[[test]]
name = "const_accessors"
path = "tests/const_accessors.rs"
[[test]]
name = "edge_cases"
path = "tests/edge_cases.rs"
[[test]]
name = "field_codec"
path = "tests/field_codec.rs"
[[test]]
name = "flags"
path = "tests/flags.rs"
[[test]]
name = "fuzz_roundtrip"
path = "tests/fuzz_roundtrip.rs"
[[test]]
name = "net"
path = "tests/net.rs"
[[test]]
name = "net_mock"
path = "tests/net_mock.rs"
[[test]]
name = "protocol_shapes"
path = "tests/protocol_shapes.rs"
[[test]]
name = "serde_compat"
path = "tests/serde_compat.rs"
[[test]]
name = "wide_field_placement"
path = "tests/wide_field_placement.rs"
[[bench]]
name = "bitfield_bench"
path = "benches/bitfield_bench.rs"
harness = false
[[bench]]
name = "bitstream_bench"
path = "benches/bitstream_bench.rs"
harness = false
[[bench]]
name = "message_bench"
path = "benches/message_bench.rs"
harness = false
[dependencies.bnb-macros]
version = "0.3.2"
package = "bitsandbytes-macros"
[dependencies.bytes]
version = "1"
optional = true
[dependencies.tokio-util]
version = "0.7"
features = [
"codec",
"net",
]
optional = true
[dependencies.tracing]
version = "0.1"
optional = true
[dev-dependencies.arbitrary-int]
version = "2.1"
[dev-dependencies.bitbybit]
version = "1.3"
[dev-dependencies.criterion]
version = "0.8"
features = ["html_reports"]
[dev-dependencies.futures-util]
version = "0.3"
features = [
"std",
"sink",
]
default-features = false
[dev-dependencies.modular-bitfield-msb]
version = "0.11"
[dev-dependencies.proptest]
version = "1"
[dev-dependencies.serde]
version = "1"
features = ["derive"]
[dev-dependencies.serde_json]
version = "1"
[dev-dependencies.tokio]
version = "1"
features = [
"rt",
"net",
"io-util",
"macros",
]
[dev-dependencies.tracing]
version = "0.1"
[dev-dependencies.tracing-subscriber]
version = "0.3"
features = ["fmt"]
default-features = false
[dev-dependencies.trybuild]
version = "1.0"
[lints.clippy]
module_inception = "allow"
print_stderr = "warn"
print_stdout = "warn"
upper_case_acronyms = "allow"
[lints.clippy.all]
level = "deny"
priority = -1
[lints.clippy.pedantic]
level = "warn"
priority = -1
[lints.rust]
missing_docs = "warn"
unreachable_pub = "warn"
unsafe_op_in_unsafe_fn = "deny"