asbytes 0.2.0

Traits for viewing data as byte slices or consuming data into byte vectors. Relies on bytemuck for POD safety.
Documentation
Build #3016622 2026-03-14 23:21:12

# rustc version rustc 1.96.0-nightly (1d8897a4e 2026-03-13)

# docs.rs version docsrs 0.0.0 (a68728e7 2026-03-08 )

# build log [INFO] running `Command { std: "docker" "create" "-v" "/home/cratesfyi/workspace-builder4/builds/asbytes-0.2.0/target:/opt/rustwide/target:rw,Z" "-v" "/home/cratesfyi/workspace-builder4/builds/asbytes-0.2.0/source:/opt/rustwide/workdir:ro,Z" "-v" "/home/cratesfyi/workspace-builder4/cargo-home:/opt/rustwide/cargo-home:ro,Z" "-v" "/home/cratesfyi/workspace-builder4/rustup-home:/opt/rustwide/rustup-home:ro,Z" "-e" "SOURCE_DIR=/opt/rustwide/workdir" "-e" "CARGO_TARGET_DIR=/opt/rustwide/target" "-e" "DOCS_RS=1" "-e" "CARGO_HOME=/opt/rustwide/cargo-home" "-e" "RUSTUP_HOME=/opt/rustwide/rustup-home" "-w" "/opt/rustwide/workdir" "-m" "6442450944" "--cpus" "6" "--user" "1001:1001" "--network" "none" "ghcr.io/rust-lang/crates-build-env/linux@sha256:d429b63d4308055ea97f60fb1d3dfca48854a00942f1bd2ad806beaf015945ec" "/opt/rustwide/cargo-home/bin/cargo" "+nightly" "rustdoc" "--lib" "-Zrustdoc-map" "--features" "full" "--config" "build.rustdocflags=[\"--cfg\", \"docsrs\", \"-Z\", \"unstable-options\", \"--emit=invocation-specific\", \"--resource-suffix\", \"-20260313-1.96.0-nightly-1d8897a4e\", \"--static-root-path\", \"/-/rustdoc.static/\", \"--cap-lints\", \"warn\", \"--extern-html-root-takes-precedence\"]" "--offline" "-Zunstable-options" "--config=doc.extern-map.registries.crates-io=\"https://docs.rs/{pkg_name}/{version}/x86_64-unknown-linux-gnu\"" "-Zrustdoc-scrape-examples" "-j6" "--target" "x86_64-unknown-linux-gnu", kill_on_drop: false }` [INFO] [stderr] WARNING: Your kernel does not support swap limit capabilities or the cgroup is not mounted. Memory limited without swap. [INFO] [stdout] b8ec09a1bf67f57b6b4c113519ab505a6a10bb3d18e6a5641d42855a81f441db [INFO] running `Command { std: "docker" "start" "-a" "b8ec09a1bf67f57b6b4c113519ab505a6a10bb3d18e6a5641d42855a81f441db", kill_on_drop: false }` [INFO] [stderr] warning: Rustdoc did not scrape the following examples because they require dev-dependencies: asbytes_as_bytes_trivial, asbytes_into_bytes_trivial [INFO] [stderr] If you want Rustdoc to scrape these examples, then add `doc-scrape-examples = true` [INFO] [stderr] to the [[example]] target configuration of at least one example. [INFO] [stderr] warning: target filter specified, but no targets matched; this is a no-op [INFO] [stderr] Documenting asbytes v0.2.0 (/opt/rustwide/workdir) [INFO] [stderr] warning: unresolved link to `T` [INFO] [stderr] --> src/as_bytes.rs:93:27 [INFO] [stderr] | [INFO] [stderr] 93 | /// Implementation for [T] where T is POD. [INFO] [stderr] | ^ no item named `T` in scope [INFO] [stderr] | [INFO] [stderr] = help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]` [INFO] [stderr] = note: `#[warn(rustdoc::broken_intra_doc_links)]` on by default [INFO] [stderr] [INFO] [stderr] warning: unresolved link to `T` [INFO] [stderr] --> src/into_bytes.rs:103:28 [INFO] [stderr] | [INFO] [stderr] 103 | /// Implementation for &[T] where T is Pod. [INFO] [stderr] | ^ no item named `T` in scope [INFO] [stderr] | [INFO] [stderr] = help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]` [INFO] [stderr] [INFO] [stderr] warning: unresolved link to `T` [INFO] [stderr] --> src/into_bytes.rs:115:31 [INFO] [stderr] | [INFO] [stderr] 115 | /// Implementation for Box<[T]> where T is POD. [INFO] [stderr] | ^ no item named `T` in scope [INFO] [stderr] | [INFO] [stderr] = help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]` [INFO] [stderr] [INFO] [stderr] warning: unclosed HTML tag `u8` [INFO] [stderr] --> /opt/rustwide/workdir/Readme.md:86:148 [INFO] [stderr] | [INFO] [stderr] 86 | ...different data types to an I/O stream (simulated here by a Vec<u8>). The generic send_data function accepts any type T that imple... [INFO] [stderr] | ^^^^ [INFO] [stderr] | [INFO] [stderr] = note: `#[warn(rustdoc::invalid_html_tags)]` on by default [INFO] [stderr] help: try marking as source code [INFO] [stderr] | [INFO] [stderr] 86 | This example showcases the IntoBytes trait, demonstrating how it facilitates writing different data types to an I/O stream (simulated here by a `Vec<u8>`). The generic send_data function accepts any type T that implements IntoBytes. Inside the function, data.into_bytes() consumes the input data and returns an owned Vec<u8>. This owned vector is necessary when the receiving function or operation (like writer.write_all) requires ownership or when the data needs to live beyond the current scope (e.g., in asynchronous operations). The example sends a POD struct (with explicit padding for Pod safety), a String, a Vec<f32>, and an array, showing how IntoBytes provides a uniform way to prepare diverse data for serialization or transmission. Note that types like String and Vec are moved and consumed, while Copy types are technically moved but the original variable remains usable due to the copy. [INFO] [stderr] | + + [INFO] [stderr] [INFO] [stderr] warning: unclosed HTML tag `u8` [INFO] [stderr] --> /opt/rustwide/workdir/Readme.md:86:319 [INFO] [stderr] | [INFO] [stderr] 86 | ....into_bytes() consumes the input data and returns an owned Vec<u8>. This owned vector is necessary when the receiving function or... [INFO] [stderr] | ^^^^ [INFO] [stderr] | [INFO] [stderr] help: try marking as source code [INFO] [stderr] | [INFO] [stderr] 86 | This example showcases the IntoBytes trait, demonstrating how it facilitates writing different data types to an I/O stream (simulated here by a Vec<u8>). The generic send_data function accepts any type T that implements IntoBytes. Inside the function, data.into_bytes() consumes the input data and returns an owned `Vec<u8>`. This owned vector is necessary when the receiving function or operation (like writer.write_all) requires ownership or when the data needs to live beyond the current scope (e.g., in asynchronous operations). The example sends a POD struct (with explicit padding for Pod safety), a String, a Vec<f32>, and an array, showing how IntoBytes provides a uniform way to prepare diverse data for serialization or transmission. Note that types like String and Vec are moved and consumed, while Copy types are technically moved but the original variable remains usable due to the copy. [INFO] [stderr] | + + [INFO] [stderr] [INFO] [stderr] warning: unclosed HTML tag `f32` [INFO] [stderr] --> /opt/rustwide/workdir/Readme.md:86:618 [INFO] [stderr] | [INFO] [stderr] 86 | ...struct (with explicit padding for Pod safety), a String, a Vec<f32>, and an array, showing how IntoBytes provides a uniform way t... [INFO] [stderr] | ^^^^^ [INFO] [stderr] | [INFO] [stderr] help: try marking as source code [INFO] [stderr] | [INFO] [stderr] 86 | This example showcases the IntoBytes trait, demonstrating how it facilitates writing different data types to an I/O stream (simulated here by a Vec<u8>). The generic send_data function accepts any type T that implements IntoBytes. Inside the function, data.into_bytes() consumes the input data and returns an owned Vec<u8>. This owned vector is necessary when the receiving function or operation (like writer.write_all) requires ownership or when the data needs to live beyond the current scope (e.g., in asynchronous operations). The example sends a POD struct (with explicit padding for Pod safety), a String, a `Vec<f32>`, and an array, showing how IntoBytes provides a uniform way to prepare diverse data for serialization or transmission. Note that types like String and Vec are moved and consumed, while Copy types are technically moved but the original variable remains usable due to the copy. [INFO] [stderr] | + + [INFO] [stderr] [INFO] [stderr] warning: unclosed HTML tag `T` [INFO] [stderr] --> src/as_bytes.rs:68:29 [INFO] [stderr] | [INFO] [stderr] 68 | /// Implementation for Vec<T> where T is POD. [INFO] [stderr] | ^^^ [INFO] [stderr] | [INFO] [stderr] help: try marking as source code [INFO] [stderr] | [INFO] [stderr] 68 | /// Implementation for `Vec<T>` where T is POD. [INFO] [stderr] | + + [INFO] [stderr] [INFO] [stderr] warning: unclosed HTML tag `T` [INFO] [stderr] --> src/into_bytes.rs:91:29 [INFO] [stderr] | [INFO] [stderr] 91 | /// Implementation for Box<T> where T is POD. [INFO] [stderr] | ^^^ [INFO] [stderr] | [INFO] [stderr] help: try marking as source code [INFO] [stderr] | [INFO] [stderr] 91 | /// Implementation for `Box<T>` where T is POD. [INFO] [stderr] | + + [INFO] [stderr] [INFO] [stderr] warning: unclosed HTML tag `T` [INFO] [stderr] --> src/into_bytes.rs:127:34 [INFO] [stderr] | [INFO] [stderr] 127 | /// Implementation for VecDeque<T> where T is POD. [INFO] [stderr] | ^^^ [INFO] [stderr] | [INFO] [stderr] help: try marking as source code [INFO] [stderr] | [INFO] [stderr] 127 | /// Implementation for `VecDeque<T>` where T is POD. [INFO] [stderr] | + + [INFO] [stderr] [INFO] [stderr] warning: `asbytes` (lib doc) generated 9 warnings [INFO] [stderr] Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.39s [INFO] [stderr] Generated /opt/rustwide/target/x86_64-unknown-linux-gnu/doc/asbytes/index.html [INFO] running `Command { std: "docker" "inspect" "b8ec09a1bf67f57b6b4c113519ab505a6a10bb3d18e6a5641d42855a81f441db", kill_on_drop: false }` [INFO] running `Command { std: "docker" "rm" "-f" "b8ec09a1bf67f57b6b4c113519ab505a6a10bb3d18e6a5641d42855a81f441db", kill_on_drop: false }` [INFO] [stdout] b8ec09a1bf67f57b6b4c113519ab505a6a10bb3d18e6a5641d42855a81f441db