Utilities for working with bytes
  • Rust 99.6%
  • Shell 0.4%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Balazs Horvath cd976af14e
Some checks failed
CI / rustfmt (push) Has been cancelled
CI / minrust (push) Has been cancelled
CI / stable (push) Has been cancelled
CI / stable-1 (push) Has been cancelled
CI / stable-2 (push) Has been cancelled
CI / stable-3 (push) Has been cancelled
CI / nightly (push) Has been cancelled
CI / panic=abort tests (push) Has been cancelled
CI / cross (push) Has been cancelled
CI / cross-1 (push) Has been cancelled
CI / cross-2 (push) Has been cancelled
CI / cross-3 (push) Has been cancelled
CI / cross-4 (push) Has been cancelled
CI / no-std (push) Has been cancelled
CI / tsan (push) Has been cancelled
CI / miri (push) Has been cancelled
CI / loom (push) Has been cancelled
CI / Publish Documentation (push) Has been cancelled
Update to bytes v1.12.1 (cherry-picked from upstream tokio-rs/bytes)
2026-08-02 22:51:44 +02:00
.github/workflows Add feature to support platforms without atomic CAS (#467) 2025-01-31 18:52:54 +09:00
benches test(benches): encloses bytes into test::black_box for clone benches (#691) 2024-04-11 11:45:18 +02:00
ci Merge commit from fork 2026-02-03 14:40:22 +01:00
src Update to bytes v1.12.1 (cherry-picked from upstream tokio-rs/bytes) 2026-08-02 22:51:44 +02:00
tests Update to bytes v1.12.1 (cherry-picked from upstream tokio-rs/bytes) 2026-08-02 22:51:44 +02:00
.gitignore Initial commit 2015-01-30 00:04:33 -08:00
Cargo.toml Update to bytes v1.12.1 (cherry-picked from upstream tokio-rs/bytes) 2026-08-02 22:51:44 +02:00
CHANGELOG.md Update to bytes v1.12.1 (cherry-picked from upstream tokio-rs/bytes) 2026-08-02 22:51:44 +02:00
clippy.toml Bump MSRV to 1.57 (#788) 2025-07-16 10:33:07 +02:00
LICENSE Clarify license as MIT (#216) 2018-06-18 12:49:34 -07:00
README.md Add feature to support platforms without atomic CAS (#467) 2025-01-31 18:52:54 +09:00
SECURITY.md readme: add security policy (#649) 2024-01-03 17:22:39 +01:00

Bytes

A utility library for working with bytes.

Crates.io Build Status

Documentation

Usage

To use bytes, first add this to your Cargo.toml:

[dependencies]
bytes = "1"

Next, add this to your crate:

use bytes::{Bytes, BytesMut, Buf, BufMut};

no_std support

To use bytes with no_std environment, disable the (enabled by default) std feature.

[dependencies]
bytes = { version = "1", default-features = false }

To use bytes with no_std environment without atomic CAS, such as thumbv6m, you also need to enable the extra-platforms feature. See the documentation for the portable-atomic crate for more information.

The MSRV when extra-platforms feature is enabled depends on the MSRV of portable-atomic.

Serde support

Serde support is optional and disabled by default. To enable use the feature serde.

[dependencies]
bytes = { version = "1", features = ["serde"] }

The MSRV when serde feature is enabled depends on the MSRV of serde.

Building documentation

When building the bytes documentation the docsrs option should be used, otherwise feature gates will not be shown. This requires a nightly toolchain:

RUSTDOCFLAGS="--cfg docsrs" cargo +nightly doc

License

This project is licensed under the MIT license.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in bytes by you, shall be licensed as MIT, without any additional terms or conditions.