Skip to content

Add bounded search and comparison for byte views #760

Closed

Description

@LunaStev

Motivation

The search/comparison helpers operate on NUL-terminated str. Bytes views have no equivalent bounded helpers for protocol payloads containing zero bytes.

Starting points: std/bytes/types.wave, std/string/find.wave, std/string/cmp.wave.

Scope

Add equality, single-byte search and first-subsequence search over explicit byte lengths. Use checked result conventions so invalid input is distinguishable from no match. An empty needle matches at offset zero. Do not allocate, mutate inputs or change string helpers (#715/#716).

Difficulty: easy.

Completion criteria

  • Cover embedded NUL, empty inputs, missing matches and a needle longer than the input.
  • Find first/last-position and overlapping candidate matches correctly.
  • Reject invalid views without reading out of bounds.
  • Exercise native O0/O2 and a WebAssembly target.

Activity

  1. added
    enhancement
    good first issue
    needs testing
    on Sep 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementgood first issueneeds testing

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions