### Build `bytes` documentation with feature gates Source: https://github.com/tokio-rs/bytes/blob/master/README.md This command-line snippet demonstrates how to build the `bytes` crate's documentation using `cargo doc` with a nightly toolchain. The `RUSTDOCFLAGS="--cfg docsrs"` flag ensures that feature gates are properly displayed in the generated documentation, providing a complete view of the API. ```bash RUSTDOCFLAGS="--cfg docsrs" cargo +nightly doc ``` -------------------------------- ### Enable Serde support for `bytes` in Cargo.toml Source: https://github.com/tokio-rs/bytes/blob/master/README.md This `Cargo.toml` snippet illustrates how to enable the optional `serde` feature for the `bytes` crate. Enabling this feature allows `Bytes` and `BytesMut` types to be serialized and deserialized using the Serde framework, facilitating data interchange. ```toml [dependencies] bytes = { version = "1", features = ["serde"] } ``` -------------------------------- ### Import `bytes` types in Rust Source: https://github.com/tokio-rs/bytes/blob/master/README.md This Rust snippet demonstrates how to import essential types like `Bytes`, `BytesMut`, `Buf`, and `BufMut` from the `bytes` crate into your Rust code. Importing these types makes them directly accessible and usable within your program. ```rust use bytes::{Bytes, BytesMut, Buf, BufMut}; ``` -------------------------------- ### Add `bytes` dependency to Cargo.toml Source: https://github.com/tokio-rs/bytes/blob/master/README.md This snippet shows how to add the `bytes` library as a dependency to your Rust project's `Cargo.toml` file. It specifies version `1` for compatibility, making the crate available for use in your project. ```toml [dependencies] bytes = "1" ``` -------------------------------- ### Configure `bytes` for `no_std` environment in Cargo.toml Source: https://github.com/tokio-rs/bytes/blob/master/README.md This `Cargo.toml` configuration snippet shows how to disable the default `std` feature of the `bytes` crate, enabling its use in `no_std` environments. This is crucial for embedded systems or contexts where the Rust standard library is not available. ```toml [dependencies] bytes = { version = "1", default-features = false } ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.