wire-codec 1.2.0

Binary frame codec and protocol codec toolkit. Length-prefixed, varint-prefixed, delimiter-based, checksummed, and custom framing strategies. Built-in varint, zigzag, bitfield, packed struct, CRC, and COBS encoding. Allocation-free core, no_std, runtime-agnostic, with optional tokio-util and futures codec adapters.
Documentation
name: CI

on:
  push:
    branches: [main, dev]
  pull_request:
    branches: [main, dev]
  schedule:
    # Weekly run so toolchain releases and new RustSec advisories surface
    # even when nobody pushes.
    - cron: "17 6 * * 1"
  workflow_dispatch:

env:
  CARGO_TERM_COLOR: always
  RUSTFLAGS: "-D warnings"

jobs:
  check:
    name: Check (${{ matrix.os }}, ${{ matrix.rust }})
    runs-on: ${{ matrix.os }}
    strategy:
      fail-fast: false
      matrix:
        os: [ubuntu-latest, macos-latest, windows-latest]
        rust: [stable, "1.85.0"]
    env:
      # rust-toolchain.toml pins the development toolchain, and rustup gives
      # that file precedence over `rustup default`. RUSTUP_TOOLCHAIN outranks
      # the file, so each leg really builds with matrix.rust.
      RUSTUP_TOOLCHAIN: ${{ matrix.rust }}
    steps:
      - uses: actions/checkout@v5
      - uses: actions/setup-node@v5
        with:
          node-version: 24
      - uses: dtolnay/rust-toolchain@master
        with:
          toolchain: ${{ matrix.rust }}
          components: clippy, rustfmt
      - name: Verify toolchain
        shell: bash
        run: |
          rustc --version
          cargo --version
          if [ "${{ matrix.rust }}" != "stable" ]; then
            rustc --version | grep -F "rustc ${{ matrix.rust }}"
          fi
      - name: Cache
        uses: actions/cache@v5
        with:
          path: |
            ~/.cargo/registry
            ~/.cargo/git
            target
          key: ${{ runner.os }}-${{ matrix.rust }}-cargo-${{ hashFiles('**/Cargo.lock') }}
      - name: Format
        if: matrix.rust == 'stable'
        run: cargo fmt --all -- --check
      - run: cargo clippy --all-targets --all-features -- -D warnings
      - run: cargo clippy --all-targets --no-default-features -- -D warnings
      - run: cargo test --all-features
      - run: cargo test
      - run: cargo test --no-default-features
      - name: Docs
        if: matrix.rust == 'stable'
        run: cargo doc --no-deps --all-features
        env:
          RUSTDOCFLAGS: "-D warnings"

  features:
    name: Feature combinations
    runs-on: ubuntu-latest
    strategy:
      fail-fast: false
      matrix:
        features:
          - "--no-default-features --features bytes"
          - "--no-default-features --features memchr"
          - "--features memchr"
          - "--features bytes"
          - "--features tokio-util"
          - "--features asynchronous-codec"
    env:
      RUSTUP_TOOLCHAIN: stable
    steps:
      - uses: actions/checkout@v5
      - uses: dtolnay/rust-toolchain@stable
        with:
          components: clippy
      - run: cargo clippy --all-targets ${{ matrix.features }} -- -D warnings
      - run: cargo test ${{ matrix.features }}

  no-std:
    name: no_std and wasm builds
    runs-on: ubuntu-latest
    env:
      RUSTUP_TOOLCHAIN: stable
    steps:
      - uses: actions/checkout@v5
      - uses: dtolnay/rust-toolchain@stable
        with:
          targets: thumbv7em-none-eabihf, wasm32-unknown-unknown
      - run: cargo build --no-default-features --target thumbv7em-none-eabihf
      - run: cargo build --no-default-features --features memchr,bytes --target thumbv7em-none-eabihf
      - run: cargo build --no-default-features --target wasm32-unknown-unknown
      - name: MSRV no_std build
        run: |
          rustup toolchain install 1.85.0 --profile minimal --target thumbv7em-none-eabihf
          cargo +1.85.0 build --no-default-features --target thumbv7em-none-eabihf

  thirty-two-bit:
    name: 32-bit (${{ matrix.target }})
    strategy:
      fail-fast: false
      matrix:
        include:
          - os: windows-latest
            target: i686-pc-windows-msvc
          - os: ubuntu-latest
            target: i686-unknown-linux-gnu
    runs-on: ${{ matrix.os }}
    env:
      RUSTUP_TOOLCHAIN: stable
    steps:
      - uses: actions/checkout@v5
      - uses: dtolnay/rust-toolchain@stable
        with:
          targets: ${{ matrix.target }}
      - name: Install 32-bit C runtime
        if: matrix.target == 'i686-unknown-linux-gnu'
        run: sudo apt-get update && sudo apt-get install -y gcc-multilib
      - run: cargo test --target ${{ matrix.target }} --all-features
      - run: cargo test --target ${{ matrix.target }} --release

  docs-rs:
    name: docs.rs build
    runs-on: ubuntu-latest
    env:
      RUSTUP_TOOLCHAIN: nightly
    steps:
      - uses: actions/checkout@v5
      - uses: dtolnay/rust-toolchain@nightly
      - run: cargo doc --no-deps --all-features
        env:
          RUSTDOCFLAGS: "--cfg docsrs -D warnings"

  fuzz:
    name: Fuzz smoke test
    runs-on: ubuntu-latest
    env:
      RUSTUP_TOOLCHAIN: nightly
    steps:
      - uses: actions/checkout@v5
      - uses: dtolnay/rust-toolchain@nightly
      - uses: taiki-e/install-action@v2
        with:
          tool: cargo-fuzz
      - name: Run every target for 30 seconds
        # The prebuilt cargo-fuzz binary is a musl build and would default to
        # its own target triple; fuzz against the runner's glibc target.
        run: |
          for target in $(cargo fuzz list); do
            cargo fuzz run --target x86_64-unknown-linux-gnu "$target" -- -max_total_time=30
          done

  semver:
    name: Semver check
    runs-on: ubuntu-latest
    env:
      RUSTUP_TOOLCHAIN: stable
    steps:
      - uses: actions/checkout@v5
      - uses: dtolnay/rust-toolchain@stable
      - uses: obi1kenobi/cargo-semver-checks-action@v2

  supply-chain:
    name: Supply chain
    runs-on: ubuntu-latest
    env:
      # The audit action installs cargo-audit from source; build it with the
      # latest stable rather than the pinned development toolchain.
      RUSTUP_TOOLCHAIN: stable
    steps:
      - uses: actions/checkout@v5
      - uses: dtolnay/rust-toolchain@stable
      - name: cargo audit
        uses: rustsec/audit-check@v2
        with:
          token: ${{ secrets.GITHUB_TOKEN }}
      - name: cargo deny
        uses: EmbarkStudios/cargo-deny-action@v2
        with:
          command: check
          arguments: --all-features