Skip to content

0.2.0

Latest

Choose a tag to compare

@Dave861 Dave861 released this 25 Jul 18:23

[0.2.0] - 2026-07-25

Added

  • A complete multi-element matching family on Span, MutableSpan,
    InlineArray, and RawSpan: firstRange(of:), lastRange(of:),
    contains(_ pattern:), starts(with:), and ends(with:), with documented
    empty-pattern semantics.
  • Multi-element separator forms of forEachSplit and the split cursors,
    including compiler-checked lifetime dependence on both the base and separator.
  • Full read-only RawSpan parity: predicate and byte search, last-index search,
    min/max, comparison, trimming, window visitation, chunk/window/split cursors,
    and predicate-based splitting.
  • C-locale ASCII whitespace trimming conveniences on Span<UInt8> and
    RawSpan. The six-byte set includes vertical tab; the WHATWG divergence is
    explicit in the API documentation.
  • RawSpan.validatedUTF8(), an Apple-26-available bridge to the standard
    library's UTF8Span(validating:) rather than a duplicate validator.
  • A “Parsing bytes without allocating” DocC article, lifetime-diagnostics
    cookbook, parser regression test, and executable zero-malloc parsing benchmark.

Changed

  • Cursor factories now mirror familiar stdlib/swift-algorithms spellings:
    chunks(ofCount:), windows(ofCount:), and
    split(separator:maxSplits:omittingEmptySubsequences:), with byte-count forms
    on RawSpan.
  • The 0.1.x chunkCursor, windowCursor, and splitCursor spellings remain as
    deprecated forwarders for source compatibility and are planned for removal in
    0.3.0.
  • Benchmarks now cover absent, end-of-input, and 10%-depth byte and pattern
    matches through the public Span/RawSpan APIs. Full results record zero
    allocations through p99 on every borrowed-view path, and the parser has a
    checked static zero-allocation threshold.

Fixed

  • Corrected cursor next() lifetime dependence from @_lifetime(&self) to
    @_lifetime(copy self). Callers can now hold several pieces simultaneously,
    nest cursors, and interleave traversals while genuine storage escapes remain
    compiler errors. Positive lifetime-ergonomics tests and compile-fail fixtures
    pin both sides of the rule.

Performance

  • Added portable memchr/memcmp fast paths for Span<UInt8>, Span<Int8>,
    and RawSpan first-index, first-range, prefix/suffix, and equality operations,
    with scalar fallbacks and differential tests. Reverse search remains scalar
    because Darwin does not provide memrchr.